【发布时间】:2016-07-07 00:20:44
【问题描述】:
在澳大利亚,一位客户在 5 月的第一天输入了 "1/5" 作为快捷方式。我们刚刚从 Windows Server 2008 迁移到 Windows Server 2012。
在 LinqPad 中使用以下代码:
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-au", false);
System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthDayPattern.Dump();
DateTime.Parse("1/5").Dump();
在 Windows Server 2008 上:
dd MMMM
2016 年 1 月 5 日上午 12:00:00
在 Windows Server 2012 R2 上:
MMMM d
2016 年 5 月 1 日上午 12:00:00
问题:
- 为什么 MonthDayPattern 发生了变化?澳大利亚人总是先有日,后有月
- 可以在 Windows Server UI 中的什么位置进行设置? UI 仅公开长短格式,不公开月日格式
- 鉴于可能在整个系统中发生
DateTime.Parse(例如模型绑定、验证等),我如何以最少的更改解决我的应用程序中的问题
【问题讨论】:
-
您使用的是哪个版本的 Linqpad?
-
4,我们服务器上没有.Net 4.6,所以不能使用5
标签: c# .net cultureinfo