ISO 8601 is an international standard published by the International Organization for Standardization that defines how to represent dates and times in a clear, unambiguous format. It's the format behind strings like '2025-07-04T14:30:00Z' — widely used in APIs, databases, log files, and data interchange formats.
The Basic Format
ISO 8601 dates are written from largest unit to smallest: year, month, day. The full date-time format is: YYYY-MM-DDTHH:MM:SS followed by a time zone designator. The 'T' separates the date from the time. A 'Z' suffix means UTC. A ±HH:MM suffix gives the UTC offset.
- 2025-07-04 — date only
- 2025-07-04T14:30:00Z — UTC date-time
- 2025-07-04T09:30:00−05:00 — date-time with UTC offset
- 2025-07-04T14:30:00.123Z — with milliseconds
Why It Matters
The most common alternatives to ISO 8601 are ambiguous. '07/04/2025' could be July 4 (US format) or April 7 (most of the rest of the world). '4-Jul-25' is clearer but doesn't sort correctly as a string. ISO 8601 dates sort lexicographically because year comes first — '2025-12-01' sorts after '2025-03-15' correctly as a plain string comparison.
ISO 8601 is also parseable by standard libraries in every major programming language without custom format strings. JSON has no native date type, so JSON APIs almost universally use ISO 8601 strings. The Temporal API (upcoming Web standard) and existing libraries like Luxon, date-fns, and Java's java.time all work natively with ISO 8601.
Common Mistakes
Omitting the time zone designator ('2025-07-04T14:30:00' with no Z or offset) creates an ambiguous timestamp — some parsers treat it as UTC, others as local time. Always include Z or an explicit offset. Mixing local time and UTC in the same system causes subtle bugs that are very hard to trace: data appears correct locally but is off by hours for users in other zones.