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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find MM/dd/yyyy HH:mm:ss.fff Datetime \w milliseconds
Expression
(?n:^(?=\d)((?<month>(0?[13578])|1[02]|(0?[469]|11)(?!.31)|0?2(?(.29)(?=.29.((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|(?!.3[01])))(?<sep>[-./])(?<day>0?[1-9]|[12]\d|3[01])\k<sep>(?<year>(1[6-9]|[2-9]\d)\d{2})\x20)(?<time>(?<hours>[01]\d|2[0-3]):(?<minutes>[0-5]\d):(?<seconds>[0-5]\d)\.(?<milliseconds>\d{3}))$)
Description
Date-time with milliseconds. MM/dd/yyyy HH:mm:ss.fff Time is in military format and requires leading zeroes for single digit hours and seconds and two digit milliseconds. All fields are required. This was a special request modification of another regex.
Matches
05/4/2005 12:34:53.102 | 12/31/2096 23:59:59.999
Non-Matches
05/4/2005 | 12:34:53.102
Author Rating: Not yet rated. Michael Ash
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: its not working for me
Name: Ravikumar C
Date: 1/19/2011 2:13:03 AM
Comment:
Hi Michael Ash, i want to Validate 12/31/2096 23:59:59.999 these kind of Dates , but the Above Expression is failing, is that i need to trim anything from it .


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