Title |
Test
Find
data time validator
|
Expression |
^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-2]) ([0-1][0-9]|2[0-4]):([0-4][0-9]|5[0-9]):([0-4][0-9]|5[0-9])$ |
Description |
it will match a valid date & time string which looks like this : 2006-12-31 23:59:59 |
Matches |
2006-12-31 23:59:59 |
Non-Matches |
2006-13-31 4:59:65 |
Author |
Rating:
Not yet rated.
Sina Salek
|
Source |
|
Your Rating |
|
Title: Leap Years
Name: Michael Ash
Date: 6/12/2006 10:36:30 AM
Comment:
For a date regex that accounts for leap years see http://regexadvice.com/blogs/mash/archive/2004/06/17/309.aspx
Title: 32 days in a month??
Name: K Overmars
Date: 6/11/2006 5:04:30 AM
Comment:
I think you you'r regex also supports 32 days in a month.
Also it does not do anything with leap years and thus a user can always fill in incorrect dates. Don't get me wrong I do not know a regex that also takes into account leap years either.