total months between two dates c#

67

c# calculate difference between two dates in days -

(EndDate - StartDate).TotalDays //double
(EndDate.Date - StartDate.Date).Days //int

total months between two dates c# -

((date1.Year - date2.Year) * 12) + date1.Month - date2.Month

Comments

Submit
0 Comments