[Required]
[Display(Name = "Birth Date")]
[DataType(DataType.Date)]
[DisplayFormat(DataFormatString = "{0:MMM-dd-yyyy}", ApplyFormatInEditMode = true)]
[RegularExpression(@"(((0[1-9]|1[0-2])\/(0|1)[0-9]|2[0-9]|3[0-1])\/((19|20)\d\d))$", ErrorMessage = "Invalid date format.")]
public DateTime BirthDate { get; set; }
When the viewis retrieved, the birth date set to the field from the database is: 1/18/1985 12:00:00 am
I change it to: 01/18/1985 and submit the Form.
The controller server-side validation catches it as an error - invalid date format.
What am I doing wrong?