DateTime ISO 8601 without timezone component

Devin picture Devin · Oct 14, 2015 · Viewed 11.2k times · Source

I've been doing work with parsing datetime strings for our international application. I'm running into an interpretation issue that I can't seem to find a definitive answer. Should an ISO 8601 datetime string without a timezone component be treated as local time?

Per wikipedia (which I don't want to base my business decisions off of):

If no UTC relation information is given with a time representation, the time is assumed to be in local time.

However, I can't find supporting documentation via ISO or any other generally acceptable source of truth. Everything that I've found talks about how to handle offsets for local time (e.g. +/- 0500, etc). Assuming local time in these cases would help me substantially as my users can submit the same date for all regions without needed to calculate the specific offset for each region.

For example:

2012-01-01T00:00:00 # Convert to local
2012-01-01T00:00:00Z # Zulu/UTC...don't convert

Is there an established interpretation for timezone-less ISO 8601 strings?

Answer

John3136 picture John3136 · Oct 14, 2015

Section 4.2.2 of ISO 8601 gives examples with no TZ designator saying they are local times. 4.2.4 says UTC times use the 'Z' designator. Of course it always raises the question "local time where?"...

The zone designator is empty if use is made of local time in accordance with 4.2.2.2 through 4.2.2.4, it is the UTC designator [Z] if use is made of UTC of day in accordance with 4.2.4 and it is the difference-component if use is made of local time and the difference from UTC in accordance with 4.2.5.2.