【发布时间】:2012-10-11 18:04:09
【问题描述】:
我在 asp.net mvc 中设置验证日期格式 Chrome 时遇到问题,对于 IE 等其他浏览器,Firefox 可以正常工作。
我已经在我的模型中定义了日期,比如下一个代码:
[Required]
[Display(Name = "Data fi publicació")]
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public DateTime PublishingEndDate { get; set; }
在我看来:
@Html.TextBoxFor(model => model.PublishingEndDate)
@Html.ValidationMessageFor(model => model.PublishingEndDate)
问题似乎@Html.ValidationMessageFor 使用MM/dd/yyyy 格式验证日期,但我想要的是使用欧洲格式dd/MM/yyyy 进行验证。如何将默认文化验证格式日期更改为 dd/MM/yyyy?
感谢您的帮助
【问题讨论】:
-
这里问了一个类似的问题:stackoverflow.com/questions/5199835/…
标签: asp.net-mvc