什么是mvc3中正确的日期格式 [英] what is proper Date format in mvc3
问题描述
mvc3中的正确日期格式是什么
i我收到错误
选择日期作为无效日期
并设置日期格式
<前lang =c#> 受保护 void Application_BeginRequest()
{
System.Globalization.CultureInfo newCulture =(System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture。克隆();
newCulture.DateTimeFormat.ShortDatePattern = dd / MM / yyyy;
newCulture.DateTimeFormat.DateSeparator = /;
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
}
< blockquote> .validator.addMethod(' date',
函数(value,element,params){
if ( this .optional(element)){
return true ;
}
var ok = true ;
尝试 {
.datepicker.parseDate(' dd / mm / yy',value);
}
catch (错误){
ok = false ;
}
return ok;
});
本作品
what is proper Date format in mvc3
i am getting error
while selecting date as invalid date
and have set date format
protected void Application_BeginRequest()
{
System.Globalization.CultureInfo newCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
newCulture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
newCulture.DateTimeFormat.DateSeparator = "/";
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
}
.validator.addMethod('date', function (value, element, params) { if (this.optional(element)) { return true; } var ok = true; try {
.datepicker.parseDate('dd/mm/yy', value); } catch (err) { ok = false; } return ok; });
This Works
这篇关于什么是mvc3中正确的日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!