Tuesday, May 4, 2010

Three way to get the name of month from a Date.

1. string str= String.Format("{0:mmmm}", DateTime.Now);

2. string str = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(DateTime.Now.Month);

3. System.Globalization.DateTimeFormatInfo ifo = new
System.Globalization.DateTimeFormatInfo();
str = ifo.GetMonthName(Date.Month);

By following the same way you can also get the name of the year or day of from date.

Thanks.

No comments:

Post a Comment