I want do validation time(format HH:MM
) using regular expression. I have :
[DataType(DataType.Time)]
[RegularExpression(@"^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$", ErrorMessage = "Time format HH:MM ")]
public System.DateTime Time { get; set; }
And when I add time in textbox in form dynamic validation (side client) is ok. When i write example 43:444
it is select. When I write example 12:43
is ok (does not detect the error) but when I click submit, ErrorMessage was showed, although format is ok. How i can repair it?