编辑器中的MVC DateTime模板日期格式错误



我有一个EditorFor模板来格式化文本框中的日期:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%= Html.TextBox("", (Model.HasValue ? Model.Value.ToString("dd/MM/yyyy") : string.Empty)) %>

问题是它的呈现是美国的MM/dd/yyyy格式

这只发生在我的生产服务器上,而不是我的开发机器上。这是我第一次在我的生产服务器上看到这个问题,因为我所有的其他网站都是英式格式。

任何想法?

在web.config中添加全球化设置:

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

最新更新