我的应用程序设置为web.config中的pt-BR文化(Date是dd-mm-yyyy):
<globalization enableClientBasedCulture="false" requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="iso-8859-15" responseHeaderEncoding="utf-8" resourceProviderFactoryType="string" enableBestFitResponseEncoding="true" culture="pt-BR" uiCulture="pt-BR" />
在我的系统上创建的所有DateTime都是正确的格式,但我创建了一个这样的控制器方法:
public ActionResult Test(DateTime date) { }
当日期与portuguese-br格式一样时,在浏览器中直接调用该方法就会传递null,如下所示:
mysite/Test/?date=19/01/2012 => date = null in my controller mysite/Test/?date=01/01/2012 => date is fine,but in US format (mm-dd-yyyy)
如何解决这个问题,接受我的日期格式?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。