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

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find DateTime ISO8601 Parser
Expression
/(\d{4})-?(\d{2})-?(\d{2})[T\s]?(\d{2}):?(\d{2})(?::?(\d{2})(\.\d+)?)?(Z|(?:([+-]\d{2})(?::?(\d{2}))?))?/i
Description
Parses various timestrings in the ISO8601 (or similar) format into a predictable array of elements. [1] = Year [2] = Month [3] = Day [4] = Hour [5] = Minute [6] = Seconds [8] = "Z" is UTC [9] = Timezone Offset Hour [10] = Timezone Offset Minute
Matches
1978-12-18T17:17:00Z | 1978-12-19T02:17:00+09 | 1978-12-18T17:17:00-00:00 | 1978-12-18T12:17:00-0500 | 1978-12-18 17:17:00 | 1978-12-18 17:17:00.021Z | 19781218T171700Z | 19781219T021700+09 | 19781218T171700-00:00 | 19781218T121700-0500 | 19781218 171700 | 19781218 171700.021Z
Non-Matches
foo | 78-12-18T17:17:00Z | 1978-12 | 1978-12-18A
Author Rating: Not yet rated. Luke Stevenson
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-2024, RegexAdvice.com | ASP.NET Tutorials