DatePicker格式问题

问题描述:

我正在尝试使用Kendo UI DatePicker

I'm trying to use Kendo UI DatePicker

 @(Html.Kendo().DatePickerFor(model => model.CalledInAt).Format("dd/MM/yyyy HH:mm tt").Value(DateTime.Now).HtmlAttributes(new { @style = "width:205px" }))

我正在将ASP.NET MVC 4与实体框架一起使用.

I'm using ASP.NET MVC 4 with entity framework.

当我尝试提交表格时,它给了我错误. 值'19/09/2013 04:08 AM'对于CalledInAt无效"

when i try to submit a form it gives me the error. "The value '19/09/2013 04:08 AM' is not valid for CalledInAt"

如果我将格式更改为dd/MM/yyyy,则可以使用.像下面这样的作品.

If i change the format to dd/MM/yyyy then it works. something like below works.

@(Html.Kendo().DatePickerFor(model => model.CalledInAt).Format("MM/dd/yyyy HH:mm tt").Value(DateTime.Now).HtmlAttributes(new { @style = "width:205px" }))

原因是什么?

尝试在网络配置中设置与日期格式匹配的区域性.

Try to set the culture in web config that match with date format.

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

查看此链接 ASP.NET支持不同文化的日期时间