ISO 8601 Date/Time Format Reference

ISO 8601 date, time, interval and duration formats with component definitions.

Reference for ISO 8601 date and time representations: calendar, ordinal and week dates, times with timezone offsets, durations (PnYnMnD) and intervals, in both basic and extended forms with worked examples. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

What is the difference between basic and extended ISO 8601 format?

Extended format uses separators (2026-06-11, 14:30:00), while basic format omits them (20260611, 143000). Both encode the same value; extended is more human-readable and is what most APIs and RFC 3339 use.

ISO 8601 date and time formats

ISO 8601 is the international standard for representing dates, times, durations and intervals as unambiguous text. It underpins RFC 3339, most web APIs, and database timestamp formats. This reference groups the standard’s representations — dates, times, durations and intervals — and shows each in both basic and extended form with a worked example.

How it works

A complete ISO 8601 timestamp combines a date and a time joined by T, optionally with a timezone designator: 2026-06-11T14:30:00Z.

Dates come in three flavours: calendar (YYYY-MM-DD), ordinal (YYYY-DDD, day-of-year), and week date (YYYY-Www-D). Week numbering is ISO-specific: weeks start Monday, and week 1 holds the year’s first Thursday.

Times are hh:mm:ss with optional fractional seconds (.sss) and a timezone: Z for UTC or ±hh:mm for an offset. Reduced precision is allowed, e.g. 14:30.

Durations use the P[n]Y[n]M[n]D T[n]H[n]M[n]S grammar — a leading P, then date parts, then T before time parts. PT0S and P0D both denote zero.

Intervals combine two of the above with a /: start/end (2026-06-01/2026-06-30), start/duration (2026-06-01/P1M), or duration/end (P1M/2026-06-30).

Quick-reference table

CategoryPatternExample
Calendar date (extended)YYYY-MM-DD2026-06-11
Calendar date (basic)YYYYMMDD20260611
Ordinal dateYYYY-DDD2026-162
ISO week dateYYYY-Www-D2026-W24-4
Time (UTC)hh:mm:ssZ14:30:00Z
Time with offsethh:mm:ss±hh:mm16:30:00+02:00
Full datetime (UTC)YYYY-MM-DDThh:mm:ssZ2026-06-11T14:30:00Z
DurationPnYnMnDTnHnMnSP1Y2M10DT2H30M
Interval (start/end)start/end2026-06-01/2026-06-30
Interval (start/duration)start/duration2026-06-01/P1M

Worked example across all representations

The single instant 11 June 2026 at 14:30:00 UTC expressed in every major ISO 8601 form:

calendar date       2026-06-11
ordinal date        2026-162
ISO week date       2026-W24-4      (Thursday of week 24)
full UTC datetime   2026-06-11T14:30:00Z
with +02:00 offset  2026-06-11T16:30:00+02:00
basic datetime      20260611T143000Z
date-only basic     20260611
duration from epoch P2026Y6M11DT14H30M  (not how durations are used — see below)

Duration grammar explained

A duration string always starts with P. After that, date parts come first, then a T separator before any time parts:

P  1  Y  2  M  10  D  T  2  H  30  M
│  │     │      │     │  │  │      │
│  1 year  2 months  10 days  2 hours  30 minutes
P for Period

Omit any zero component. P1Y is one year; PT30M is exactly 30 minutes; P0D is the conventional way to express zero duration. The standard does not mandate any particular component to be present as long as the string is unambiguous.

Common pitfalls

Local time without a timezone designator. A string like 2026-06-11T14:30:00 is technically a local datetime — it has no timezone information and its meaning depends entirely on the reader’s context. This causes bugs when records are written in one timezone and read in another. In APIs and storage, always include Z or an explicit offset.

Confusing ISO week-year and calendar year. The ISO week number belongs to the year that contains the week’s Thursday. So 1 January 2027 (a Friday) belongs to 2026-W53, not 2027-W01. Use the week-date form 2026-W53-5 to express it unambiguously; never assume the ISO year matches the calendar year in early January or late December.

Basic vs. extended interoperability. Extended format (separators: 2026-06-11) is far more widely understood by libraries and humans. Basic format (no separators: 20260611) is allowed by ISO 8601 but can confuse parsers that expect separators. Prefer extended unless compactness or a specific system requires basic.

Why ISO 8601 matters

ISO 8601 strings sort chronologically when sorted as plain strings — 2026-06-11 comes before 2026-12-01 lexicographically, which is exactly the chronological order. This property makes them ideal for filenames, log keys, and database primary keys where sorting by name also means sorting by time. Ambiguous formats like 11/06/2026 lose this property and introduce locale-dependent misreadings (is that June 11 or November 6?).