MVC DateTime in Editorfor Template - date format is wrong
I have an EditorFor Template to format the date within my Text boxes:
<%@ Control Language="C#" Inherits="System.Web.Mv开发者_Go百科c.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
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?
Add a globalization setting in web.config:
<globalization uiCulture="en-GB" culture="en-GB" />
精彩评论