ISO 8601 is the international standard for representing dates, times, and durations as unambiguous, sortable strings — the format most JSON APIs, logs, and databases use.

Structure

2026-07-21T12:00:00+02:00
YYYY-MM-DDTHH:MM:SS±HH:MM
  • Date: YYYY-MM-DD, always big-endian (year, month, day) so lexical sort matches chronological sort.
  • T: literal separator between date and time.
  • Time: HH:MM:SS, 24-hour clock. Fractional seconds are allowed (12:00:00.123456).
  • Offset: +HH:MM / -HH:MM from UTC, or Z for UTC itself (short for “Zulu time”).

A missing offset means the timestamp is time-zone-naive — the standard permits it, but it’s ambiguous across systems, so prefer always including one.

Durations and intervals

ISO 8601 also defines durations (P prefix, e.g. P1DT12H = 1 day 12 hours) and intervals (<start>/<end> or <start>/<duration>), though these show up far less often in application code than the date-time format itself.

Cheatsheet

2026-07-21T12:00:00Z          # UTC, "Zulu" suffix
2026-07-21T12:00:00+02:00     # explicit UTC+2 offset
2026-07-21                    # date only
12:00:00                      # time only
P1DT12H                       # duration: 1 day, 12 hours
2026-07-21T00:00:00Z/P1D      # interval: start + duration

See python-datetime for parsing/formatting ISO 8601 strings in Python.