How to calculate the difference in months between two dates in C#?
Is there is equivalent of VB\'s DateDiff() method in C#. I need to find difference in
DateDiff()
To get difference in months (both start and end inclusive), irrespective of dates:
DateTime start = new DateTime(2013, 1, 1); DateTime end = new DateTime(2014, 2, 1); var diffMonths = (end.Month + end.Year * 12) - (start.Month + start.Year * 12);