Error submitting form with date field
I get the following error in a page where I use a datepicker. No matter what day is inserted, this error happens:
14-Fev-1991. What is that? Today is 14-Fev but not 1991! What should I do?
String was not recognized as a valid DateTime.
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3211050
System.DateTime.Parse(String s, IFormatProvider provider) +28
System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +290
[FormatException: 14-02-1991 is not a valid value for DateTime.]
System.Com开发者_如何学CponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) +452
System.ComponentModel.DataAnnotations.RangeAttribute.SetupConversion() +626
System.ComponentModel.DataAnnotations.RangeAttribute.IsValid(Object value) +38
Have you specified your default DateTimeFormat? Hope its not using US format
This is for US, you need to set it as per your requirement.
<configuration>
<system.web>
<globalization culture="en-US" uiCulture="de-DE"/>
</system.web>
</configuration>
This might help further http://msdn.microsoft.com/en-us/library/ff647353.aspx
精彩评论