ASP.NET C#

How to get the month name from month number in C#2 min read

The following asp.net c# example code demonstrate us how can we get month name from number. this example code also demonstrate us how can we get month name from a datetime object. bellow is the explain of example source code.

We created a datetime object using DateTime.Today property. DateTime.Today property get the current date without time in the web server. DteTime.Month property gets the month number from a datetime object. so we uses the DateTime.Month property to get the month number from today date that represent the current month of web server.




At last we call the DateTimeFormatInfo.GetMonthName() method that returns the culture specific full name of the specified month based on the culture associated with the current DateTimeFormatInfo object. GetmonthName method require an integer type argument that represent month number.

CultureInfo.DateTimeFormat property get or set a DateTimeFormatInfo that defines the culturally appropriate format of dates and times.

How to get the month name from month number in C#

How to get the month name from month number in C#

ASP.NET Code:

Leave a Comment