Thursday, 7 July 2011

How to get MonthName from DateTime in C#?

Following syntax can be used to get month name from current date

4 letter format
DateTime.Now.ToString( "MMMM" )

3 letter format
DateTime.Now.ToString( "MMM" )

string CurrentMonth = String.Format("{0:MMMM}", DateTime.Now).ToString();


Click here for more custom DateTime format strings

No comments:

Post a Comment