C # operations with the date when the calculation is the date most often calculate the difference between the number of days, then how does it work? The following small series to share with you.
Tools / materials
-
Visual Studio
Method / Step
-
First, open VS, click on the following new project file, as shown below
-
Then build a console program, the following structure shown in FIG.
-
Then declare the calculated date to two, as shown in FIG.
-
Next, the offset is calculated by the two dates Subtract function, as shown below
-
Then a direct call to the offset attribute days, as shown in FIG.
-
Finally, running the program can calculate the difference between the number of days of the date, as shown in FIG.
-
Finally, in the calculation of the difference we must draw attention to certain plus 1