Output of times (AM/PM) changed in Windows 10 when using DateTime.ToString(“tt”)

断了今生、忘了曾经 提交于 2019-12-03 23:52:33

You may want to look at "Culture Data Shouldn't Be Considered Stable" http://blogs.msdn.com/b/shawnste/archive/2005/04/05/405694.aspx

One bit is that we started leveraging CLDR (Common Locale Data Repository, http://cldr.unicode.org) for many locales to better align with the industry standards. You may have noticed that there are quite a few additional locales we now have data for.

I always force to use ToString("G") when changing DateTime to string with ToString() function . Then I have no problems to parse the string to DateTime again. I tested it with my client application (gets date & time in XML in "G" format and parses it to DateTime) on Windows 7/8/10.

I also found that the combination of 'en-nz' and Windows 10 upgrade suddenly change a.m./p.m.to AM/PM.

The difference is the code I maintained relaying on ToShortTimeString() output with a.m./p.m. but in Windows 10 it changes to AM/PM instead I spend ages trying to find the correct culture info/format string, and I am also trying to find the missing local setting on my new Windows 10 machine compare to my old Windows 7 machine. But it turns out that the same local setting on different version of Windows machine does indeed display a.m./p.m. AM/PM differently.

Also confirm that DateTimeFormatInfo.AMDesignator for 'en-nz' now output 'AM' instead of 'a.m.'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!