At the moment I’m creating a DateTime for each month and formatting it to only include the month.
Is there another or any better way to do this?
At the moment I’m creating a DateTime for each month and formatting it to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can use the
DateTimeFormatInfoto get that information:or to get all names:
You can also instantiate a new
DateTimeFormatInfobased on aCultureInfowithDateTimeFormatInfo.GetInstanceor you can use the current culture’sCultureInfo.DateTimeFormatproperty:Keep in mind that calendars in .Net support up to 13 months, thus you will get an extra empty string at the end for calendars with only 12 months (such as those found in en-US or fr for example).