DateTime (Month) conversion

  • Thread starter Thread starter Miguel Gómez
  • Start date Start date
M

Miguel Gómez

Hi, Guys!

Does any body can tell me if there is any function, method or property
inside the framework 2.0 which can convert the number of the month to its
corresponding name?
Something like this:

str name= fn(3);

so that fn(3) returns "march", fn(4) returns "april", etc

Thank you very much.
 
After serious thinking Miguel Gómez wrote :
Hi, Guys!

Does any body can tell me if there is any function, method or property inside
the framework 2.0 which can convert the number of the month to its
corresponding name?
Something like this:

str name= fn(3);

so that fn(3) returns "march", fn(4) returns "april", etc

Thank you very much.

DateTime dt = new DateTime(2009, 3, 1);
string monthname = dt.ToString("MMMM", new
System.Globalization.CultureInfo("en-GB")));

Adjust the culture (én-GB'in the example) to your needs.

Hans Kesting
 
Thank you very much, Hans.


Hans Kesting said:
After serious thinking Miguel Gómez wrote :

DateTime dt = new DateTime(2009, 3, 1);
string monthname = dt.ToString("MMMM", new
System.Globalization.CultureInfo("en-GB")));

Adjust the culture (én-GB'in the example) to your needs.

Hans Kesting
 
Back
Top