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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 1
Title Test Details ISO 8601 time-point
Expression
^(?:-([0-9]{1,2})|([0-9]{4}))?(?:-?(?:([0-9]{2})?(?:-?([0-9]{2}))?|W([0-9]{2})(?:-?([1-7]))?|([0-9]{3})))?(?:T([0-9]{2})(?::?([0-9]{2})(?::?([0-9]{2}))?)?(?:[,\.]([0-9]+))?(?:(Z)|([+-])([0-9]{2})(?::?([0-9]{2}))?)?)?$
Description
Validate and parse date/time string in ISO8601 format. Works with complete representation in both with basic and extended formats. Some of turncated representations and most of representations with reduced precision are also supported. It does not validate range of date/time fields in any way. Captured fields may be empty depending on what kind of representation is used. Year: $1 two-digit year with implicit century or $2 full 4-digit year. Calendar date: $3 month, $4 day of the month. Week date: $5 week of the year, $6 day of the week. Ordinal date: $7 day of the year. Time: $8 hours, $9 minutes, $10 seconds, $11 fractional part of last non-empty time field. Time zone: if $12 is Z then it's UTC zone, otherwise offset may be given as $13 direction (+/-), $14 hours and $15 minutes.
Matches
19850412T232050Z | 1985-04-12T10:15:30+0400 | 1985102 | 1985-102 | 1985W155 | 1985-W15-5 | T23:20:50 | T23,347
Non-Matches
11111 | 23,5 | 23:20
Author Rating: Not yet rated. Kacper Gutowski
   Displaying page 1 of 1 pages; Items 1 to 1

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