Get Month Name

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

How can I get the the current month name in a specific culture?

I am using: DateTime.UtcNow.Month

But I need to be sure that I am getting the name of the month in a
chosen culture.

Thanks,
Miguel
 
Hello,

How can I get the the current month name in a specific culture?

I am using: DateTime.UtcNow.Month

But I need to be sure that I am getting the name of the month in a
chosen culture.

Thanks,
Miguel

To get the month name I use
CultureInfo.CurrentCulture.DateTimeFormat.MonthNames
 
shapper was thinking very hard :
Hello,

How can I get the the current month name in a specific culture?

I am using: DateTime.UtcNow.Month

But I need to be sure that I am getting the name of the month in a
chosen culture.

Thanks,
Miguel

using System.Globalization;

string name1 =
DateTime.Now.ToString("MMMM", CultureInfo.CurrentCulture);

OR

string name2 =
CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(
DateTime.Now.Month);


Hans Kesting
 
Back
Top