DatePicker 格式问题 [英] DatePicker format issue

查看:21
本文介绍了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" }))

是什么原因?

推荐答案

尝试在 web config 中设置与日期格式匹配的文化.

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

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

请参阅此链接 ASP.NET不同文化的日期时间支持

这篇关于DatePicker 格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆