.net 如何将时间模式覆盖为12小时时间?
如何覆盖.net 如何将时间模式覆盖为12小时时间?,.net,localization,.net,Localization,如何覆盖ShortTimePattern和longtimeptern以始终在12小时内 以下代码仅适用于en-US,因为其他文化具有不同的模式 System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern = "h:mm:ss tt" System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.Sho
ShortTimePattern
和longtimeptern
以始终在12小时内
以下代码仅适用于en-US,因为其他文化具有不同的模式
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern = "h:mm:ss tt"
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortTimePattern = "h:mm tt"
我相信“HH”是指24小时,而“HH”是指12小时 试试这个: System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.ShortTimePattern=“HH:mm:ss”
System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat.LongTimePattern=“HH:mm:ss”我想到的第一件事是:你为什么要这么做 请记住,对于非美国人来说,12小时的时间可能很难理解。为什么.Net的大多数类都是区域设置感知的,这是有原因的
如果你打算在国外销售你的应用程序,你可能会被迫改变它,那么做两次同样的事情有什么意义呢?+1。我同意。对于那些不经常使用12小时制并且不会说英语的人来说,上午/下午可能会非常混乱。