Get a Culture-Specific Month Name or a Month Abbreviation

Many a time, you need your application to support multiple languages and thus formats of how things should be displayed. For instance, US uses month/day/year for the date, while Germany uses day.month.year and Russia uses day-month-year. Given that a user experience means so much now, you would want to make sure that the user of your application is comfortable with what she or he is looking at. For the month case, of which the title of this post speaks, it is quite simple:

var lcid = "fi";
var monthName = (new CultureInfo(lcid)).DateTimeFormat.GetMonthName(12);

This will get you the name of December in Finnish. Play a bit with it. You do not have to pass a string identifier of the language, you can pass a corresponding integer value. The mapping of the locale IDs to their integer values can be found here.

This entry was posted in C# and tagged , , , , , , , . Bookmark the permalink.

5 Responses to Get a Culture-Specific Month Name or a Month Abbreviation

  1. Great site. A lot of useful information here. I’m sending it to some friends!

  2. This is such a great resource that you are providing and you give it away for free. I enjoy seeing websites that understand the value of providing a prime resource for free. I truly loved reading your post. Thanks!

  3. Do you people have a facebook fan page? I looked for one on twitter but could not discover one, I would really like to become a fan!

  4. I do agree with all of the concepts you have presented for your post. They are very convincing and will definitely work. Still, the posts are very quick for novices. Could you please extend them a bit from next time? Thank you for the post.

Leave a Reply

Your email address will not be published. Required fields are marked *