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

编程入门 行业动态 更新时间:2024-10-25 19:36:00
本文介绍了日期时间支持的语言格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

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))));

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

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

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

更多推荐

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

本文发布于:2023-10-23 00:01:48,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1519130.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   语言   格式   时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!