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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Date & 24-Hour Time - US Format
Expression
^((0?[2])/(0?[1-9]|[1-2][0-9])|(0?[469]|11)/(0?[1-9]|[1-2][0-9]|30)|(0?[13578]|1[02])/(0?[1-9]|[1-2][0-9]|3[0-1]))/([1][9][0-9]{2}|[2-9][0-9]{3}) (00|0?[1-9]|1[0-9]|2[0-3])\:([0-5][0-9])\:([0-5][0-9])$
Description
This regex accepts date and time values, taking into account 29/30/31 day months. 00 hours (midnight) must have both zeros, but hours 01-09 can leave 0 off, months 1-9 can also leave 0 off.
Matches
12/31/2001 10:30:00, 3/19/1988 19:41:25
Non-Matches
4/31/2010 09:31:00, 1/30/1999 24:00:00
Author Rating: The rating for this expression. Nathon Dalton
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

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