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()
Use Noda Time:
LocalDate start = new LocalDate(2013, 1, 5); LocalDate end = new LocalDate(2014, 6, 1); Period period = Period.Between(start, end, PeriodUnits.Months); Console.WriteLine(period.Months); // 16
(example source)