Tuesday, January 15, 2008

How to get the month name according to the current windows local

I used the DateTimeFormatInfo class to get the month name as a string by calling this method GetMonthName(int) , then I found that it retrun the English representation of the month even in non english regional settings (Windows locale).

The culture aware class is the CultureInfo, which can be accessed from the Current thread, so simply call:


to get a culture specific month name.

No comments: