Identifying time zones in ISO 8601

Update:

There’s now a draft IETF proposal to extend RFC3339 with the time zone identifier in square brackets, among other things: https://datatracker.ietf.org/doc/draft-ietf-sedate-datetime-extended/

Original Answer:

I understand these are not supported by ISO 8601, correct?

Correct. ISO-8601 does not concern itself with time zone identifiers. IANA/Olson TZ names are not a “standard”. They are just the most reliable thing we have. (Some may consider them the de facto standard.)

What are platforms doing to support this?

Support what exactly? This part of your question is unclear. If you mean to support IANA time zones, well that’s all over the place. Some platforms have them built-in, and some rely on libraries. If you mean to support a string representation of an ISO-8601 date-time-offset + time zone ID, some platforms have this and some do not. You’ll have to be more specific if you want to know more.

I notice that the latest Java date/time library is using an extended ISO 8601 format for this, e.g. 2011-12-03T10:15:30+01:00[Europe/Paris]. (See DateTimeFormatter API.)

I think you are talking about DateTimeFormatter.ISO_ZONED_DATE_TIME. The docs say specifically:

The ISO-like date-time formatter…

…extends the ISO-8601 extended offset date-time format to add the time-zone. The section in square brackets is not part of the ISO-8601 standard.

So this is Java’s specific format, not a standard.

Is there some converging convention (e.g. with other languages and platforms) for extending ISO 8601 to support time zone designation?

As far as I know, there is currently no standard that covers the combining of an ISO8601 timestamp and an IANA time zone identifier into a single format. One could represent it many different ways, including:

  • 2011-12-03T10:15:30+01:00[Europe/Paris] (this is the default in Java 8)
  • 2011-12-03T10:15:30+01:00(Europe/Paris)
  • 2011-12-03T10:15:30+01:00 Europe/Paris
  • 2011-12-03T10:15:30+01:00 - Europe/Paris
  • 2011-12-03T10:15:30+01:00/Europe/Paris
  • 2011-12-03T10:15:30+01:00|Europe/Paris
  • 2011-12-03T10:15:30 Europe/Paris (+01) (this is the default in Noda Time)

If what you’re looking for is a way to include a ZonedDateTime or similar data in an API in a standardized manner, my personal recommendation would be to pass the time zone name in a separate field. That way, each portion of data is as good as it can be. For example in JSON:

{
  "timestamp": "2011-12-03T10:15:30+01:00",
  "timezone": "Europe/Paris"
}

Leave a Comment