简体   繁体   English

Editorfor Template中的MVC DateTime - 日期格式错误

[英]MVC DateTime in Editorfor Template - date format is wrong

I have an EditorFor Template to format the date within my Text boxes: 我有一个EditorFor Template来格式化我的文本框中的日期:

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

Trouble is that its rendering in the US format of MM/dd/yyyy 麻烦的是它以美国格式呈现MM / dd / yyyy

This is only happening on my production server and not my development machine. 这只发生在我的生产服务器上,而不是我的开发机器上。 This is the first time I've seen this issue on my production server as all my other sites have UK formatting. 这是我第一次在生产服务器上看到此问题,因为我的所有其他网站都有英国格式。

Any ideas? 有任何想法吗?

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM