get month of date c# code example
Example 1: c# get month number from name
int month = DateTime.ParseExact(MonthNameStr, "MMMM", CultureInfo.CurrentCulture ).Month
Example 2: c# get month number
string sMonth = DateTime.Now.ToString("MM");
int month = DateTime.ParseExact(MonthNameStr, "MMMM", CultureInfo.CurrentCulture ).Month
string sMonth = DateTime.Now.ToString("MM");