Tuesday, 3 January 2017

c# - Calculate difference between two dates (number of days)?



I see that this question has been answered for Java, JavaScript, and PHP, but not C#. So, how might one calculate the number of days between two dates in C#?


Answer



Assuming StartDate and EndDate are of type DateTime:



(EndDate - StartDate).TotalDays

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...