Title |
Test
Find
Pattern Title
|
Expression |
((([0][1-9]|[12][\d])|[3][01])[-/]([0][13578]|[1][02])[-/][1-9]\d\d\d)|((([0][1-9]|[12][\d])|[3][0])[-/]([0][13456789]|[1][012])[-/][1-9]\d\d\d)|(([0][1-9]|[12][\d])[-/][0][2][-/][1-9]\d([02468][048]|[13579][26]))|(([0][1-9]|[12][0-8])[-/][0][2][-/][1-9]\d\d\d) |
Description |
Date validation in the dd/mm/yyyy format for years 1000+ (i.e 999 or 0999 not matching) and taking february leap years into account. |
Matches |
12/12/2003 | 29-02-2004 | 31-03-1980 |
Non-Matches |
29/02/2003 | 31-04-2002 | 10-10-0999 |
Author |
Rating:
Uris Virott
|
Source |
|
Your Rating |
|
Title: Mr
Name: Siva
Date: 1/20/2010 5:24:44 AM
Comment:
Really good one.. the one will work with Eclipse and Datapower. I have tried quite a few ones however they will not work.
Title: Mr
Name: Siva
Date: 1/20/2010 5:24:22 AM
Comment:
Really good one.. the one will work with Eclipse and Datapower. I have tried quite a few ones however they will not work.
Title: The
Name: Shun Trevor
Date: 11/29/2006 4:55:57 AM
Comment:
The best date validator i have seen
Title: 19/2/2002 non-match
Name: Billy Milligan
Date: 11/11/2004 4:17:22 PM
Comment:
The way the RegEx is currently written, Feb. the 19 of any year is invalid.
this line:
([0][1-9]|[12][0-8])
Should read:
([0][1-9]|[1][\d]|[2][0-8])
Title: Leap years messed up in modified code
Name: Jeff
Date: 8/13/2004 10:17:11 AM
Comment:
Now the leap year dates don't seem to work with the modified code given July 16, 2004. Example:
29/02/2004, 29/02/1996, 29-02-1992
Title: Even Better Date Validation
Name: Uris Virott
Date: 7/16/2004 5:53:18 AM
Comment:
Improved to include validation of leap years 1000 through 9999 (includes the Gregorian divisible by 100 and divisible by 400 check: thanks for the heads up Michael).
((([0][1-9]|[12][\d])|[3][01])[-/]([0][13578]|[1][02])[-/][1-9]\d\d\d)|((([0][1-9]|[12][\d])|[3][0])[-/]([0][13456789]|[1][012])[-/][1-9]\d\d\d)|(([0][1-9]|[12][\d]) [-/][0][2][-/]([2468][1235679]|[3579][1345789])([02468][048]|[13579][26]))|(([0][1-9]|[12][0-8])[-/][0][2][-/][1-9]\d\d\d)
Title: Best Validation for the date
Name: p
Date: 7/16/2004 2:59:55 AM
Comment:
This is very very good
Title: Centenial Leap Years
Name: Michael Ash
Date: 2/11/2004 1:49:09 AM
Comment:
If you are basing this on the Gregorian Calendar you should know that not all centuries are leap years. 2100, 2200 for example are not leap years. See http://scienceworld.wolfram.com/astronomy/GregorianCalendar.html
They are several date regexs on this library that also include the century check that you can look at