bala3569 bala3569 - 3 months ago 46
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...


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"));