Skip to content

How to validate the DateTime of MM/dd/yyyy hh:mm format?

I am using MaskedEditExtender for entering a datetime. I am unable to figure out how to validate it.

Is there any Regular Expression for validating dates along with time MM/dd/yyyy hh:mm

or any Javascript function ??

Answer

THis will solve your issue:

^(([0]?[1-9]|1[0-2])/([0-2]?[0-9]|3[0-1])/[1-2]d{3}) (20|21|22|23|[0-1]?d{1}):([0-5]?d{1})$