Home » CodeDigest


Get Month Name and Day name for a Date in C#, ASP.Net
Submitted By Satheesh Babu B
On 4/11/2011 7:39:07 AM
Tags: ASP.Net,C#,CodeDigest  

Get Month Name and Day name for a Date in C#, ASP.Net


Sometimes, we may need to get the full month name and day name in ASP.Net from a given date.

In this small article, we will achieve this by 2 ways,

  1. The ToString() method of DateTime will acccept the formatting string through which we can display the full month and day name for a given date.


  2. The next method is to use DateTimeFormatInfo class of System.Globalization namespace. This class has GetMonthName() and GetDayName() method which gives the full month name and day name.

        DateTimeFormatInfo dinfo = new DateTimeFormatInfo();


         Include System.Globalization namespace for the above code to work.


Happy Coding!!

Do you have a working code that can be used by anyone? Submit it here. It may help someone in the community!!

Recent Codes
  • View All Codes..