DatePicker格式问题 [英] DatePicker format issue
本文介绍了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支持不同文化的日期时间
这篇关于DatePicker格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文