ISO 8601 Date and Time Format Explained
ISO 8601 is the international standard for representing dates and times as strings. Its canonical form — 2024-03-15T14:30:00Z — is unambiguous, sortable, and supported in every modern language and database. This guide covers the format, the RFC 3339 subset most APIs actually use, and the variants for durations, intervals, and week dates.
What is ISO 8601?
ISO 8601 is the International Organization for Standardization’s representation of dates and times. The current version (ISO 8601-1:2019 / -2:2019) defines a compact, ordered, language-neutral text format. The standard is the basis for RFC 3339, which is the actual format used by most internet protocols.
- Year-month-day order, always: 2024-03-15 (not 03/15/2024 or 15/03/2024)
- Time portion separated by a literal T or a space: 2024-03-15T14:30:00
- Timezone explicit: Z for UTC, or ±HH:MM for an offset
- Sortable as text — lexicographic order matches chronological order
The canonical date-time format
The most common form looks like 2024-03-15T14:30:00.123Z. Each component is fixed-width and zero-padded:
- YYYY-MM-DD — four-digit year, two-digit month, two-digit day
- T — separator between date and time (RFC 3339 also permits a single space)
- HH:MM:SS — 24-hour clock, zero-padded
- .fff — optional fractional seconds, any number of digits in ISO 8601; 1–9 digits in RFC 3339
- Z or ±HH:MM — timezone designator (Z = UTC = offset +00:00)
Timezone designators
ISO 8601 timezones are encoded as offsets from UTC, never as zone abbreviations. The string carries enough information to reconstruct the exact UTC instant.
- Z: UTC (equivalent to +00:00)
- +09:00: nine hours ahead of UTC (e.g. Japan Standard Time)
- -05:00: five hours behind UTC (e.g. EST)
- +05:30: India Standard Time (half-hour offset)
- +05:45: Nepal Standard Time (45-minute offset)
- Local time without an offset is only allowed if the timezone is communicated out-of-band — avoid in APIs
ISO 8601 vs RFC 3339
RFC 3339 is a profile of ISO 8601, more restrictive and easier to parse. Most internet protocols (JSON APIs, HTTP, IETF specs) use RFC 3339 specifically.
- RFC 3339 requires the T (or space) separator; ISO 8601 allows it to be omitted
- RFC 3339 requires a timezone offset; ISO 8601 allows local-only timestamps
- RFC 3339 caps fractional-second precision at the parser; ISO 8601 allows arbitrary precision
- RFC 3339 forbids the "basic" (no-hyphen) format; ISO 8601 allows 20240315T143000Z
- Most date libraries (JavaScript Date, Java Instant, Python isoparse) target RFC 3339
Variants: durations, intervals, week dates
ISO 8601 covers more than instants. Three variants come up regularly:
- Durations: P3Y6M4DT12H30M5S = 3 years, 6 months, 4 days, 12 hours, 30 minutes, 5 seconds
- Intervals: 2024-01-01/2024-02-01, or 2024-01-01/P1M (start + duration)
- Ordinal dates: 2024-075 = the 75th day of 2024 (March 15)
- Week dates: 2024-W11-5 = Friday of week 11 of 2024
- Repeating intervals: R3/2024-01-01/P1D = three one-day intervals starting Jan 1
Common ISO 8601 mistakes
Even with a strict standard, parsing and emitting code makes the same handful of errors:
- Dropping the timezone: 2024-03-15T14:30:00 with no Z or offset is ambiguous
- Using "+0000" instead of "+00:00" — some parsers accept it, RFC 3339 does not
- Using a non-letter T (Unicode lookalikes copy-paste poorly)
- Mixing 12-hour AM/PM into ISO 8601 — it is always 24-hour
- Truncating fractional seconds without rounding — pick a precision and stick to it
- Treating ISO 8601 as locale-aware — it is not; the format is fixed regardless of language
ISO 8601 FAQ
- Is "2024-03-15 14:30:00Z" valid ISO 8601?
- Yes — the space between date and time is allowed in ISO 8601 (and in RFC 3339). The T form is preferred for unambiguous machine parsing.
- What does the Z at the end mean?
- Z means UTC (offset +00:00). It is short for "Zulu time", the NATO/aviation phonetic for the letter Z.
- How do I parse ISO 8601 in JavaScript?
- new Date("2024-03-15T14:30:00Z") works for the standard RFC 3339 subset. For broader ISO 8601 support, use a library like date-fns or the Temporal API.
- Is ISO 8601 the same as RFC 3339?
- No — RFC 3339 is a strict subset. Every RFC 3339 timestamp is valid ISO 8601, but not every ISO 8601 timestamp is valid RFC 3339.
- What is the difference between ISO 8601 and ISO 8601-2?
- ISO 8601-1 covers basic date and time representation. ISO 8601-2 (the 2019 extension) adds new constructs like uncertain dates, qualifying values, and complex intervals.