Can someone help me build a regular expression to validate time?
Valid values would be from 0:00 to 23:59.
When the time is less than 10:00 it should also su
[RegularExpression(@"^(0[1-9]|1[0-2]):[0-5][0-9]:[0-5][0-9] (am|pm|AM|PM)$", ErrorMessage = "Invalid Time.")]
Try this
Try this regular expression:
^(?:[01]?[0-9]|2[0-3]):[0-5][0-9]$
Or to be more distinct:
^(?:0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$