c# - DateTime.Now 忽略 Windows 10 设置

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

代码:

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

输出:2015年9月23日

改为:2015 年 9 月 23 日

enter image description here

最佳答案

检查 web.config 的自动检测区域性:

<globalization culture="auto" uiCulture="auto" enableClientBasedCulture="true"/>

<system.web>

或者手动设置:

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

关于c# - DateTime.Now 忽略 Windows 10 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32752725/

相关文章:

c# - 为什么在 ASP.NET 中使用中继器?

c# - 如何在返回单个结果的查询中从 DapperRow 获取值

c# - 如何在 C++ 中触发 C# COM 事件?

c# - 部署 Office 2007 加载项

c# - 我如何解决 "Please make sure that the file is accessible and that it is a valid assembly or COM component"?

c# - 无效的回发或回调参数错误?

c# - 同时调用或调用多个方法?

c# - 使用 Thinktecture IdentityServer3 进行身份验证/授权 native Android 应用程序的正确方法是什么

c# - asp.net 中的 Page.Title 与 Title 标签

asp.net-mvc - 在 ASP.NET MVC 中处理表单的正确方法是什么?