开发者

How does `MonthNames` work for different cultures?

开发者 https://www.devze.com 2022-12-13 06:50 出处:网络
When you call System.Globalization.DateTimeFormatInfo.CurrentI开发者_运维百科nfo.MonthNames you get a list of Month Names based on the current culture. If I change the current thread culture to a diff

When you call System.Globalization.DateTimeFormatInfo.CurrentI开发者_运维百科nfo.MonthNames you get a list of Month Names based on the current culture. If I change the current thread culture to a different one I should be able to get the month names back in that language. This seems to be working for French, but not for Japanese. What do I need to do so that I can get Japanese Months back? Is there something that I need to install for the OS, or do I need to install a .NET addon?


This is working for me:

Thread.CurrentThread.CurrentCulture = new CultureInfo("ja-JP");
foreach (var month in DateTimeFormatInfo.CurrentInfo.MonthNames)
{
    Console.WriteLine(month);
}

I don't have anything special installed--at least, not that I know of!

The Wikipedia article on Japanese calendar has an explanation of the Arabic numeral format.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号