bala3569 bala3569 - 1 year ago 102
C# Question

Get Month name from month number

Possible Duplicate:

How to get the MonthName in c#?

I used the following c# syntax to get month name from month no but i get
i want only

System.Globalization.DateTimeFormatInfo mfi = new
string strMonthName = mfi.GetMonthName(8).ToString();

Any suggestion...

Answer Source

For short month names use:

string monthName = new DateTime(2010, 8, 1)
    .ToString("MMM", CultureInfo.InvariantCulture);

For long/full month names for Spanish ("es") culture

string fullMonthName = new DateTime(2015, i, 1).ToString("MMMM", CultureInfo.CreateSpecificCulture("es"));
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download