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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Date and Time Validation
Expression
(^0?[1-9]|^1[0-2])\/(0?[1-9]|[1-2][0-9]|3[0-1])\/(19|20)?[0-9][0-9](\s(((0?[0-9]|1[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?)|((0?[0-9]|1[0-2]):[0-5][0-9](:[0-5][0-9])?\s(AM|PM))))?$
Description
Expression to validate a date with or without time in standard or 24 hour format with optional milliseconds (01/12/08 23:31:05 or 5/12/1974 11:59 PM).
Matches
01/28/08 22:34:12 | 10/23/1952 5:23:01 PM | 6/2/02 22:59 | 5/13/04
Non-Matches
1/32/08 | 12/29/005 | 6/14/05 23:00:02 PM | 10/2/02 13:00 AM
Author Rating: Not yet rated. Gregg Jensen
Source Gregg Jensen
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: dd/mm/yy hh:mm
Name: Rima
Date: 4/1/2008 1:09:49 AM
Comment:
Hi ! I need expression for dd/mm/yyyy hh:mm with optional seconds


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