For Developers

A Developer's Guide to ISO 8601

One date format, unambiguous everywhere, that happens to also sort correctly as plain text. There are very few good reasons not to default to it.

Before ISO 8601 was widely adopted, the same date could be written a dozen different ways — 03/04/2026 means March 4th in the US and April 3rd almost everywhere else, and that ambiguity has caused real, expensive mistakes in shipping dates, contracts, and financial records. ISO 8601 exists specifically to remove that ambiguity.

The format itself

The full format looks like 2026-07-16T14:30:00Z — year, month, day, separated by hyphens, then a literal T, then hours, minutes, seconds, and finally a timezone indicator. That trailing Z means "Zulu time," which is just another name for UTC. If a timestamp needs to represent a specific local offset instead, it's written as +05:30 or -08:00 in place of the Z.

Why the field order matters

Largest unit first, smallest last — that ordering isn't arbitrary. It means ISO 8601 strings sort correctly using plain alphabetical/lexicographic comparison, with zero date-parsing logic required. A list of ISO 8601 timestamps sorted as plain text is automatically sorted chronologically. That single property is why log files, filenames, and database indexes benefit so much from this format specifically — you get correct chronological sorting for free.

Common mistakes people make with it

The most frequent one is dropping the timezone indicator entirely and writing something like 2026-07-16T14:30:00 with no Z or offset. That string is technically valid ISO 8601 syntax, but it's ambiguous about which timezone it refers to, which defeats a large part of the format's purpose. Always include the offset or the Z. A second common mistake is treating "ISO date" as meaning only the date part (2026-07-16) when a full timestamp is actually needed — the date-only form is valid ISO 8601, but it silently discards the time-of-day information if that mattered.

Where you'll see it, and how to get it

Nearly every programming language can produce ISO 8601 directly — JavaScript's date.toISOString(), Python's datetime.isoformat(), and equivalents in most other languages. If you need to eyeball what a raw Unix timestamp looks like in ISO 8601 format, the timestamp converter shows it alongside several other formats.

Related

Related tools & reading