Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, May 13, 2010

Get the difference of month between two dates


private
static int monthDifference(DateTime startDate, DateTime endDate)

{       int monthsApart =
12 * (startDate.Year - endDate.Year) + startDate.Month - endDate.Month;
      return Math.Abs(monthsApart);



}

No comments:

Post a Comment