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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Short datetime en-US
Expression
^(([0]\d)|([1][0-2])|(\d))[/](([0-2]\d)|([3][0-1])|(\d))[/][2][0]\d{2}[,]\s(([0]\d)|([1][0-2])|(\d))[:][0-5]\d\s[AP][M]
Description
This is basic datetime validator that does bother with seconds and enforces slashes, a comma after the date, as well as a year that must start with "20". Morning and evening are represented by "AM" or "PM" only.
Matches
1/31/2086, 9:50 AM | 08/04/2082, 09:13 PM | 1/2/2000, 1:12 PM
Non-Matches
1/31/2086 9:50 AM | 08/04/2082, 09:13 | 1/2/1900, 1:12 PM
Author Rating: Not yet rated. Dave Hull
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