JavaScript - Regular expression for date time format

Asked By amita gupta on 25-Mar-07 11:42 PM

i need regular exp for following date time format as i want to use this regular expression for validation purpose using javascript:-

Time Type=<+ | - | R > <YYYYMMDDhhmmsstnn>

 

Where

+ positive time offset from UTC

- negative time offset from UTC

R relative to current time at MS/SMG

yyyy = year, mm = month,  dd = day, hh = hour, mm = minute,  ss = second, t = tenths of a second, nn = offset from UTC in quarter hours (NOTE:  MILITARY-24-HOUR FORMAT).

K Pravin Kumar Reddy replied to amita gupta on 26-Mar-07 12:00 AM
Here is a simplistic regexp that only validates the format, not the content:

^\d{1,2}\/\d{1,2}\/\d{4}\s\d{1,2}\:\d{1,2}\:\d{1,2}$

For instance, it would treat the following as valid:

99/99/9999 99:99:99