How to get complete month name from DateTime
Solution 1:
Use the "MMMM" custom format specifier:
DateTime.Now.ToString("MMMM");
Solution 2:
You can do as mservidio suggested, or even better, keep track of your culture using this overload:
DateTime.Now.ToString("MMMM", CultureInfo.InvariantCulture);
Solution 3:
If you want the current month you can use
DateTime.Now.ToString("MMMM")
to get the full month or DateTime.Now.ToString("MMM")
to get an abbreviated month.
If you have some other date that you want to get the month string for, after it is loaded into a DateTime object, you can use the same functions off of that object:dt.ToString("MMMM")
to get the full month or dt.ToString("MMM")
to get an abbreviated month.
Reference: Custom Date and Time Format Strings
Alternatively, if you need culture specific month names, then you could try these:
DateTimeFormatInfo.GetAbbreviatedMonthName Method
DateTimeFormatInfo.GetMonthName Method