Internet timestamps
Summary
This article explains ABNF (RFC 3339) and IXDTF (RFC 9557) timestamp formats with grammar rules, and syntax comparison. You will learn about format specifiers, timestamp types, and precision handling.
Introduction #
Timestamps are used in internet protocols, file metadata, and data serialization formats to represent date and time in a machine-readable form. Two major formats for these timestamps are defined in RFC 3339 and RFC 9557.
RFC 3339 #
RFC 3339 (Date and Time on the Internet: Timestamps) defines a profile of ISO 8601 for use in internet protocols. It uses Augmented Backus-Naur Form (ABNF) to specify the grammar.
Grammar #
date-fullyear = 4DIGIT
date-month = 2DIGIT ; 01-12
date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31
time-hour = 2DIGIT ; 00-23
time-minute = 2DIGIT ; 00-59
time-second = 2DIGIT ; 00-58, 00-59, 00-60
time-secfrac = "." 1*DIGIT
time-numoffset = ("+" / "-") time-hour ":" time-minute
time-offset = "Z" / time-numoffset
partial-time = time-hour ":" time-minute ":" time-second [time-secfrac]
full-date = date-fullyear "-" date-month "-" date-mday
full-time = partial-time time-offset
date-time = full-date "T" full-time
IXDTF (RFC 9557) #
Internet Extended Date/Time Format (IXDTF) extends RFC 3339 with additional features like approximate times, uncertain times, and extended timezone information.
Grammar #
ixdtf-date-time = full-date "T" ixdtf-full-time
ixdtf-full-time = partial-time ixdtf-offset
ixdtf-offset = (time-offset / ixdtf-numoffset)
ixdtf-numoffset = ("+" / "-") time-hour [[":" time-minute] [precision]]
precision = "~" / "%" / "@" / "*"
Syntax comparison #
The following table compares the key syntactic differences between RFC 3339 and IXDTF (RFC 9557) timestamp formats:
| Component | RFC 3339 | IXDTF |
|---|---|---|
| Date separator | - | - |
| Time separator | : | : |
| DateTime sep. | T | T |
| Timezone | Z or ±hh:mm | Z, ±hh:mm, or ±hh with precision |
| Precision | Not supported | ~, %, @, * |
| Leap seconds | Not specified | Supported (:60) |
Timestamp types #
The table below shows various timestamp representations with examples and descriptions, covering both basic formats and extended IXDTF features:
| Type | Example | Description |
|---|---|---|
| Full datetime | 2025-06-06T14:28:00Z | RFC 3339 format |
| Date only | 2025-06-06 | Full date without time |
| Time only | 14:28:00Z | Time with UTC indicator |
| Interval | 2025-06-06/2025-06-07 | Time interval |
| Duration | PT2H | 2-hour duration |
| Approximate | ~2025-06-06 | Approximate date (IXDTF) |
| Open range | ..2025-06-06 | Open interval to a date |
| Recurring | R10/2025-06-06T14:00:00Z/P2D | 10 repetitions every 2 days |
Timestamp examples #
1985-04-12T23:20:50Z1996-12-19T16:39:57-08:002020-01-01T00:00:00Z~2038-01-19T03:14:07+01:00%2001-09-09T01:46:40Z@1970-01-01T00:00:00Z*2106-02-07T06:28:15-05:00~1999-12-31T23:59:60Z2000-01-01T00:00:00.000Z2023-11-15T14:30:00.123456789Z1989-11-09T18:00:00+01:00%2012-12-21T12:00:00Z~2008-08-08T08:08:08+08:00@1969-07-20T20:17:40Z*2033-05-18T03:33:20-00:00~2004-02-29T00:00:00Z%2011-03-11T14:46:23+09:00@1977-05-25T00:00:00Z*2045-01-01T00:00:00.999Z~2022-02-22T22:22:22-22:00%
Format specifiers #
The following table explains common format specifiers used in timestamp formatting:
| Specifier | Meaning | Example |
|---|---|---|
%Y | 4-digit year | 2025 |
%y | 2-digit year | 23 |
%m | 2-digit month (01-12) | 11 |
%B | Full month name | November |
%b | Abbreviated month name | Nov |
%d | 2-digit day of month (01-31) | 15 |
%H | 2-digit hour (00-23) | 14 |
%I | 2-digit hour (01-12) | 02 |
%M | 2-digit minute (00-59) | 30 |
%S | 2-digit second (00-60) | 00 |
%f | Microseconds (6 digits) | 123456 |
%z | Timezone offset (±HHMM) | +0100 |
%:z | Timezone offset (±HH:MM) | +01:00 |
%Z | Timezone name/abbreviation | UTC, CET |
%j | Day of year (001-366) | 319 |
%U | Week number (00-53, Sunday week) | 45 |
%W | Week number (00-53, Monday week) | 45 |
%A | Full weekday name | Wednesday |
%a | Abbreviated weekday name | Wed |
%T | Time (equivalent to %H:%M:%S) | 14:30:00 |
%F | Date (equivalent to %Y-%m-%d) | 2023-11-15 |
%R | Short time (equivalent to %H:%M) | 14:30 |
%% | Literal percent sign | % |
These specifiers are commonly supported in programming languages and tools.
The exact support for these specifiers may vary between implementations, but most follow the POSIX strftime conventions.
Some implementations add extensions for nanoseconds, timezone names, or locale-specific formatting.
FAQ's #
Most common questions and brief, easy-to-understand answers on the topic:
What is the difference between RFC 3339 and IXDTF?
RFC 3339 defines a profile of ISO 8601 for internet timestamps, while IXDTF (RFC 9557) extends it with additional features like timezone offsets and precision indicators.
How do you represent timezone offsets in IXDTF?
In IXDTF, timezone offsets use the format ±hh:mm or Z for UTC, with optional precision indicators like ~ for approximate times.
Can IXDTF timestamps include leap seconds?
Yes, IXDTF supports leap seconds with the :60 notation in the seconds field when needed.
What is the maximum precision supported by these formats?
Both RFC 3339 and IXDTF support up to nanosecond precision, though implementations may limit this based on their requirements.
Further readings #
Sources and recommended, further resources on the topic:
- IETF: RFC 3339: Date and Time on the Internet
- IETF: RFC 9557: Internet Extended Date/Time Format (IXDTF)
- Wikipedia: ISO 8601
License
Internet timestamps by Jonas Jared Jacek is licensed under CC BY-SA 4.0.
This license requires that reusers give credit to the creator. It allows reusers to distribute, remix, adapt, and build upon the material in any medium or format, for noncommercial purposes only. To give credit, provide a link back to the original source, the author, and the license e.g. like this:
<p xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/"><a property="dct:title" rel="cc:attributionURL" href="https://www.ditig.com/internet-timestamps">Internet timestamps</a> by <a rel="cc:attributionURL dct:creator" property="cc:attributionName" href="https://www.j15k.com/">Jonas Jared Jacek</a> is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer">CC BY-SA 4.0</a>.</p>For more information see the Ditig legal page.