leora leora - 1 year ago 87
C# Question

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 Source

Assuming StartDate and EndDate are of type DateTime:

(EndDate - StartDate).TotalDays
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download