RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^(19[0-9]{2}|[2-9][0-9]{3})-((0(1|3|5|7|8)|10|12)-(0[1-9]|1[0-9]|2[0-9]|3[0-1])|(0(4|6|9)|11)-(0[1-9]|1[0-9]|2[0-9]|30)|(02)-(0[1-9]|1[0-9]|2[0-9]))\x20(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$
Description
Checks for the format yyyy-MM-dd HH:mm:ss also known as SortableDateTimePattern (conforms to ISO 8601) using local time. From 1900-01-01 00:00:00 to 9999-12-31 23:59:59. No check for leap year.
Matches
2004-07-12 14:25:59 | 1900-01-01 00:00:00 | 9999-12-31 23:59:59
Non-Matches
04-07-12 14:25:59 | 20004-07-12 14:25 | 2004/07/12 14:25:59
Author Rating: The rating for this expression. Jens Ulrik Jacobsen
Source I made this.
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Matches 2001-02-29
Name: daiwuju
Date: 1/3/2013 6:41:07 AM
Comment:
It is a small error, because there is no such date.


Title: 2005-1-1 or 2005-01-01?
Name: bug
Date: 2/5/2005 2:30:41 AM
Comment:
2005-1-1 or 2005-01-01?


Copyright © 2001-2025, RegexAdvice.com | ASP.NET Tutorials