ISO 8601:2004 formats

jpmckinney edited this page Feb 6, 2013 · 6 revisions

Dates should be in one of the following formats:

  • YYYY
  • YYYY-MM
  • YYYY-MM-DD
  • YYYY-MM-DDThhZ
  • YYYY-MM-DDThh:mmZ
  • YYYY-MM-DDThh:mm:ssZ

where:

  • Y is a year digit
  • M is a month digit from 01 to 12
  • D is a day digit from 01 to 31
  • h is an hour digit, from 00 to 23
  • m is a minute digit, from 00 to 59
  • s is a minute digit, from 00 to 59
  • T and Z are the literal uppercase letters "T" and "Z"

To validate a "date and time of day" representation, the following regular expression is sufficient:

^[0-9]{4}((-[0-9]{2}){0,2}|(-[0-9]{2}){2}(T[0-9]{2}(:[0-9]{2}(:[0-9]{2})?)?Z)?)$
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.