开发者

MVC DateTime in Editorfor Template - date format is wrong

开发者 https://www.devze.com 2023-03-23 16:45 出处:网络
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?>\" %>

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" />
0

精彩评论

暂无评论...
验证码 换一张
取 消