DateTimeFormatInfo.MonthDayPattern 已在 Windows Server 2012 中更改 - 如何将其恢复?
DateTimeFormatInfo.MonthDayPattern Has Changed in Windows Server 2012 - How Can I set it back?
在澳大利亚,一位客户一直在输入 "1/5"
作为 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
1/05/2016 12:00:00 AM
在 Windows 服务器 2012 R2 上:
MMMM d
5/01/2016 12:00:00 AM
问题:
- 为什么 MonthDayPattern 发生了变化?澳大利亚人总是先有日,后有月
- 在 Windows 服务器 UI 的什么地方可以设置? UI只暴露长短格式,不暴露月日格式
- 考虑到可能
DateTime.Parse
在整个系统中发生(例如模型绑定、验证等) ,我如何才能以最少的更改解决我的应用程序中的问题
我可以在 Windows Server 2012 上复制该问题。如果您添加...
System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern.Dump();
你会看到的returns...
d/MM/yyyy
只有 MonthDayPattern 似乎不正确。这可能是一个错误。我会在 https://connect.microsoft.com/.
上记录问题
同时您可以简单地设置 MonthDayPattern....
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-au", false);
System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern.Dump();
System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthDayPattern.Dump();
DateTime.Parse("1/5").Dump();
System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthDayPattern = "d MMMM";
DateTime.Parse("1/5").Dump();
在 Windows 服务器 2012 R2 上:
d/MM/yyyy
MMMM d
5/01/2016 12:00:00 AM
1/05/2016 12:00:00 AM
在澳大利亚,一位客户一直在输入 "1/5"
作为 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
1/05/2016 12:00:00 AM
在 Windows 服务器 2012 R2 上:
MMMM d
5/01/2016 12:00:00 AM
问题:
- 为什么 MonthDayPattern 发生了变化?澳大利亚人总是先有日,后有月
- 在 Windows 服务器 UI 的什么地方可以设置? UI只暴露长短格式,不暴露月日格式
- 考虑到可能
DateTime.Parse
在整个系统中发生(例如模型绑定、验证等) ,我如何才能以最少的更改解决我的应用程序中的问题
我可以在 Windows Server 2012 上复制该问题。如果您添加...
System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern.Dump();
你会看到的returns...
d/MM/yyyy
只有 MonthDayPattern 似乎不正确。这可能是一个错误。我会在 https://connect.microsoft.com/.
上记录问题同时您可以简单地设置 MonthDayPattern....
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-au", false);
System.Globalization.DateTimeFormatInfo.CurrentInfo.ShortDatePattern.Dump();
System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthDayPattern.Dump();
DateTime.Parse("1/5").Dump();
System.Globalization.DateTimeFormatInfo.CurrentInfo.MonthDayPattern = "d MMMM";
DateTime.Parse("1/5").Dump();
在 Windows 服务器 2012 R2 上:
d/MM/yyyy
MMMM d
5/01/2016 12:00:00 AM
1/05/2016 12:00:00 AM