How to define the validation for the format HH: MM?

advertisements

I am doing an updation. So I have set value from database to a text box in time format like HH:MM

 00:00
 if I enter 8:00//it should show error
 if I enter 08:0//it should show error

How can I perform this???. Entering this value in a text box. Ajax code also acceptable. it is a web application form and it is in a 24 hours format also.


You can use the RegularExpressionValidator and below ValidationExpression.

  ValidationExpression="^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]\040(AM|am|PM|pm)$"

Here is more info on how to use the RegularExpressionValidator.