ISO 8601 Date Regular Expression

Category: Strings | Views Total: 15 views

A regular expression to validate an ISO 8601 date string.

/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(\.\d+)?(([+-]\d\d:\d\d)|Z)?$/i

Matches:

  • 2021-10-13T04:13:00+01:00
  • 2021-10-13T12:13:00-08:00
  • 2021-10-13T12:13:00

Non-Matches:

  • 2021-10-13

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Leave a Reply