The RFC 3339 timestamp format is defined here.
The timestamp must include the full date and time measured to at least second-accuracy, plus a local offset from UTC, e.g.
2024-03-23T13:59:30Z
Here the terminating Z
indicates a zero offset from UTC – it's equivalent to +00:00
.
The T
can be replaced by a space for readability, e.g.
2024-03-23 13:59:30Z
Seconds can be expressed to fractional accuracy, e.g. to millisecond or microsecond accuracy:
2024-03-23 13:59:30.123Z 2024-03-23 13:59:30.123456Z
The local offset from UTC can be expressed in hours and minutes, e.g.
2024-03-23 13:59:30+02:00
The offset is calculated as follows:
offset = local_time - utc_time
So, to convert from local time to UTC:
utc_time = local_time - offset
The following timestamps indicate the same instant in time:
2024-03-23 13:59:30+02:00 2024-03-23 11:59:30+00:00 2024-03-23 11:59:30Z
An offset can be negative, e.g. the following timestamps indicate the same instant in time:
2024-03-23 13:59:30-02:00 2024-03-23 15:59:30+00:00 2024-03-23 15:59:30Z