Answers for "c# datetime numbers for months"

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
0

find month number from date C#

string name = DateTime.ParseExact("01/21/2014", "MM/dd/yyyy", null).ToString("MMMM"); //January
Posted by: Guest on May-18-2020

C# Answers by Framework

Browse Popular Code Answers by Language