public static Int32 GetDateDiffInMonths(string CurrentDate, string targetDate)
{
DateTime startDate = System.Convert.ToDateTime(CurrentDate);
DateTime endDate = System.Convert.ToDateTime(targetDate);
int monthsApart = 12 * (startDate.Year - endDate.Year) + startDate.Month - endDate.Month;
return Math.Abs(monthsApart);
}
{
DateTime startDate = System.Convert.ToDateTime(CurrentDate);
DateTime endDate = System.Convert.ToDateTime(targetDate);
int monthsApart = 12 * (startDate.Year - endDate.Year) + startDate.Month - endDate.Month;
return Math.Abs(monthsApart);
}
No comments:
Post a Comment