简体   繁体   English

为什么不是所有语言都采用长日期格式的一周中的哪一天?

[英]Why is not the day of the week formated in long date format for all languages?

We have used date.ToString ("D") for formatting the date. 我们使用date.ToString ("D")来格式化日期。 But when we globalizat the application to other languages ​​we encounter problems. 但是当我们将应用程序全局化为其他语言时,我们会遇到问题。 We expect the day of the week to appear when we use the long date format, but it's not lake so for all languages. 我们希望在使用长日期格式时出现星期几,但对于所有语言,它都不是湖泊。 According http://www.basicdatepicker.com/samples/cultureinfo.aspx , it is far from all language that print out day a week for the long date format. 根据http://www.basicdatepicker.com/samples/cultureinfo.aspx ,它远远不是所有语言,每周打印一次长日期格式。 How should we do to format the date? 我们该如何格式化日期?

If you need an explicit format, specify it like so; 如果您需要显式格式,请像这样指定;

DateTime date = DateTime.Now;
string s = date.ToString("dddd, dd MMMM yyyy");

According to the MSDN doco, the "D" format specifier is affected by the Calendar, which is Culture specific. 根据MSDN doco,“D”格式说明符受日历的影响,日历是特定于文化的。

You shouldn't make assumptions about string formatting or Date display in particular, when internationalising. 在国际化时,您不应该对字符串格式或日期显示做出假设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM