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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Date and Hour with yyyy-MM-dd HH:mm format
Expression
((20)[0-9]{2})-((0[1-9])|(1[0-2]))-((3[0-1])|([0-2][1-9]|([1-2][0-9])))\s((2[0-3])|[0-1][0-9]):[0-5][0-9]
Description
Date and hour with fixed format, only accepting year >= 2000. If you want more flexibility on the year, you could replace the first expression (20)[0-9]{2} with only [0-9]{4}, that would allow years from 0000 to 9999.
Matches
2000-12-29 10:00 2014-10-20 23:59 2001-01-01 00:00
Non-Matches
1999-12-29 09:00 2014-01-02 9:00 2000-1-1 23:10
Author Rating: Not yet rated. Marcelo Teixeira de Melo Filho
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-2025, RegexAdvice.com | ASP.NET Tutorials