日期时间支持的语言格式?日期、语言、格式、时间

由网友(我想有一个人明白我,即使我什么都没说。)分享简介:日期时间让你的格式取决于当前的文化。什么是文化默认支持?DateTime let you format depending of the current culture. What are the culture supported by default?记住使用 this.Date.Value.ToString(...

日期时间让你的格式取决于当前的文化。什么是文化默认支持?

DateTime let you format depending of the current culture. What are the culture supported by default?

记住使用 this.Date.Value.ToString(MMMM)的情况下我有这将打印月,如果区域性设置为英语(美国)但将打印维耶如果文化是法语-CA。此格式的文件可以在 MSDN网站,但并没有给文化的范围,这个可以翻译。

The scenario I have in mind use this.Date.Value.ToString("MMMM") which will print "January" if the culture is set to english-us but will print "Janvier" if the culture is in french-ca. This formatting documentation can be found at MSDN website but doesn't give the scope of culture this one can translate.

我想知道是什么语言的支持,如果语言不,我有哪些选择?

I would like to know what languages are supported and if a language is not, what are my options?

推荐答案

您可以使用的 CultureInfo.GetCultures 让所有支持的文化。

You can use CultureInfo.GetCultures to get all supported cultures.

CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
string allTranslatedJanuaries = 
    string.Join(Environment.NewLine, cultures.Select(c =>
        String.Format("{0}: {1}", c.EnglishName, c.DateTimeFormat.GetMonthName(1))));

下面是一个演示: http://ideone.com/9CUjK

在我的服务器上安装了352文化,在ideone只有112。

On my server 352 cultures are installed, upon ideone only 112.

阅读全文

相关推荐

最新文章