liveBook · Manning

ISO 8601

As explained in The Design of Web APIs, Second Edition

An ISO 8601 date format is a standardized textual representation of calendar dates defined by ISO 8601.

ISO 8601 provides readable, standardized strings for dates and times, improving API clarity and interoperability. It supports dates, date-times, UTC, and time-zone offsets. section 8.10 section 8.5.3

Readable transaction date

A bank transaction can use 1982-12-20T10:31:00Z instead of the opaque Unix timestamp 409228260. For date-only data, use 1982-12-20. The final Z identifies UTC; +01:00 can represent an equivalent local offset. section 8.5.3

Choose the representation according to the consumer’s needs:

  • Prefer ISO 8601 strings when consumers need readable, clear, editable API values. section 8.5.3
  • Use date-only precision when time is unnecessary; avoid extra precision that creates time-zone complexity. section 8.10
  • Prefer UTC unless requirements call for an offset, and document timestamp units if numeric timestamps are used. section 8.5.3

How The Design of Web APIs, Second Edition covers it

How deep it goes
Defines date and date-time forms, explains components, offsets, UTC, and precision choices.
Examples
Uses a bank transaction, date-only value, UTC timestamp, and equivalent one-hour time-zone offset.
What it assumes
Assumes only a need to represent dates or times; teaches format components and precision choices.
What you can do after
Apply it by choosing readable date or date-time strings and limiting precision to actual requirements.
How it connects
Connects date strings with JSON Schema, Unix timestamps, UTC, and time-zone offsets.

Also explained in

Compare how 2 books explain ISO 8601 →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Design of Web APIs, Second Edition. The section links point to the parts of the book it draws on.