Saturday, August 4, 2007

ASP.NET Value of a Month as Text Instead of an Integer

To get the value of a month as text (it's name) instead of an integer use,
string myMonth = DateTime.Now.ToString("MMMM", 
System.Globalization.CultureInfo.GetCultureInfo("en-US"));
For additional date formatting options, see http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx.

No comments: