RFC 3339: Timestamps for internet protocols

Summary

In July 2002, Graham Klyne and Chris Newman specified a lean profile of ISO 8601 for date and time in internet protocols in RFC 3339. Timestamps such as 2002-07-01T12:00:00Z or 2002-07-01T14:00:00+02:00 are unambiguous, always contain a four-digit year and can be sorted as strings. The format became the quiet foundation of logs, APIs, feeds and configuration files.

A small slice of a large standard

ISO 8601 allows many notations, from week numbers to abbreviated forms. RFC 3339 deliberately picks only a few: full date, time with optional fractions of a second and always a time zone, either Z for UTC or an offset such as +02:00. Two-digit years are explicitly forbidden; the text recalls the problems around the year 2000.

A practical side effect: if all timestamps have the same offset, they can be sorted as plain strings. The T between date and time may be replaced by a space for readability, and T and Z may also be lower case.

When the time zone is unknown

RFC 3339 makes a fine distinction: +00:00 and Z mean that UTC is the preferred reference. The offset -00:00, by contrast, says that the UTC time is correct but the local time zone is unknown, a convention the text takes over from email.

What RFC 3339 cannot do is state a real time zone such as Europe/Berlin that knows daylight saving rules. In April 2024 RFC 9557 added an extension in square brackets for this, for example 2022-07-08T00:14:07+01:00[Europe/Paris].

Ideas

  • Every timestamp contains a four-digit year.
  • A time zone is mandatory, either Z or an offset.
  • Fractions of a second are optional.
  • Timestamps with the same offset can be sorted as text.
  • -00:00 means: UTC known, local time zone unknown.
  • Leap seconds are represented as second 60.

Insights

  • A deliberately small profile of a large standard is more useful to machines than the full standard with all its variants.
  • Time values need clear meaning as well as shared syntax; an offset is not yet a time zone with rules.

Facts

  • RFC 3339 appeared in July 2002.
  • According to RFC 3339, two-digit years are deprecated and must not be generated.
  • Z stands for UTC, after the letter Zulu in the phonetic alphabet.
  • RFC 9557 from April 2024 adds time zone names in square brackets.

References

Remarks

  • On Linux, date --rfc-3339=seconds produces a timestamp in this format, though with a space instead of T.

Recommendations

  • Store event times in logs and databases in UTC with Z.
  • For future appointments, also store the time zone, because daylight saving rules can change.
  • Always output timestamps in APIs with an offset, never as local time without one.

Read the RFC at the RFC Editor

Search the Web Archive

Found a mistake or have something to add? Get in touch.