Instant - String Format (ISO 8601)

About

The ISO 8601 is a calendar system

The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time.

For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.

Example

2013-03-04

2004-05-23T14:25:10

2004-05-23T14:25:10.487

Syntax

It's also a date string format specification

Data elements and interchange formats – Information interchange – Representation of dates and times is an international standard covering the exchange of date and time-related data.

Even if the syntax has space for formatting, the final string is without space.

YYYY-MM-DDThh:mm:ss[.mmm]

YYYYMMDD[T hh:mm:ss[.mmm]] [ Z | ±hh:mm | ±hhmm | ±hh ]

where:

  • the brackets indicate optionality (the time, the fraction of second and zone component are optional)
  • The T is a literal character separating the date and the time
  • hh:mm:ss[.mmm] is the time component:
    • specified in the 24-hour format.
    • where the fraction of second mmm represents millisecond and is optional
  • The Z is a literal that represents the UTC time zone (The Z would come from Zulu Time)
  • ±hh:mm | ±hhmm | ±hh represents time zone offset from UTC

Documentation / Interference

Task Runner