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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
^((((([0-1]?\d)|(2[0-8]))\/((0?\d)|(1[0-2])))|(29\/((0?[1,3-9])|(1[0-2])))|(30\/((0?[1,3-9])|(1[0-2])))|(31\/((0?[13578])|(1[0-2]))))\/((19\d{2})|([2-9]\d{3}))|(29\/0?2\/(((([2468][048])|([3579][26]))00)|(((19)|([2-9]\d))(([2468]0)|([02468][48])|([13579][26]))))))\s(([01]?\d)|(2[0-3]))(:[0-5]?\d){2}$
Description
My definitive Date and Time pattern (dd/mm/yyyy hh:mm:ss). It recognizes all correct dates (>1900) and time (even february). What can I say, I'm proud of it
Matches
29/2/2004 15:16:57 | 29/01/1900 18:17:15
Non-Matches
29/2/1900 14:13:11
Author Rating: The rating for this expression. Bernat Sales
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: It does validating the month incorrectly with digit zero
Name: Marcelo
Date: 5/24/2011 5:07:00 PM
Comment:
Hi Bernat, I think your regext is validating incorrectly date with zero in month (1/0/2011 14:35:49). I've used regexpal dot com to test.


Title: American Format
Name: Tim
Date: 3/30/2011 4:52:34 PM
Comment:
I am the furthest thing from proficient with regex statements, or I would attempt this myself, but is there any way you can post this same regex with the modification for use with US date format (mm/dd/yy hh:mm:ss)?


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