Answers for "Add months From a Date C#"

C#
2

compute months c#

public static int GetMonthDifference(DateTime startDate, DateTime endDate)
{
    int monthsApart = 12 * (startDate.Year - endDate.Year) + startDate.Month - endDate.Month;
    return Math.Abs(monthsApart);
}
Posted by: Guest on July-19-2020
1

total months between two dates c#

((date1.Year - date2.Year) * 12) + date1.Month - date2.Month
Posted by: Guest on December-30-2020

C# Answers by Framework

Browse Popular Code Answers by Language