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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find TimeStamp
Expression
^[1-9]{1}[0-9]{3}-(0[1-9]{1}|1[0-2]{1})-([0-2]{1}[1-9]{1}|3[0-1]{1}) ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$
Description
Its validates a time stamp
Matches
2009-04-20 14:34:32 | 2010-03-09 12:59:00 | 1020-03-09 23:59:00
Non-Matches
text | 2009-13-00 00:00:00 | 2009-12-20 23:60:00
Author Rating: The rating for this expression. Danny
Source
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: Correction
Name: http://mvark.blogspot.com
Date: 11/26/2009 2:28:35 AM
Comment:
The first example "2009-04-20 14:34:32" fails. Change the 51st character in the expression to 0 to make it handle 20 in the day part of the date - ^[1-9]{1}[0-9]{3}-(0[1-9]{1}|1[0-2]{1})-([0-2]{1}[0-9]{1}|3[0-1]{1}) ([0-1]{1}[0-9]{1}|2[0-3]{1}):[0-5]{1}[0-9]{1}:[0-5]{1}[0-9]{1}$


Title: Incomplete
Name: foobar
Date: 8/28/2009 5:11:34 AM
Comment:
Doesn't work when the date ends in 10 or 20.


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