DateTime.Now忽略Windows 10设置

时间:2015-09-24 03:15:47

标签: c# asp.net webforms .net-4.5 windows-10

代码:

Response.Write(DateTime.Now.ToShortDateString());

输出:23/09/2015

而不是:09/23/15

enter image description here

1 个答案:

答案 0 :(得分:2)

检查web.config以了解自动检测文化:

<globalization culture="auto" uiCulture="auto" enableClientBasedCulture="true"/>
<system.web>

中的

或手动设置:

<globalization culture="en-us" uiCulture="en-us" />