I'm trying to determine what the default time zone is for an XML Schema dateTime, when it is not specific. The time zone portion at the end is optional and it may be omitted:
2013-01-11T16:02:55
I read in this answer that the time zone is undetermined when not specified. I read in the comments to this question that the default is UTC if not specified. I also read through the W3C definition and that didn't give me a clear answer.
Can any experts point me to where this is specified?
An unspecified time zone is exactly that - unspecified. No more, no less. It's not saying it's in UTC, nor is it saying it's in the local time zone or any other time zone, it's just saying that the time read from some clock somewhere was that time.
The fact that it originated from an
xs:dateTime
doesn't really play into it at all. It's just an ISO 8601 date + time (without time zone) value.It really depends on what you do with this value as to what it actually means.
In the real world, you probably should avoid values like this when working with timestamps - that is, the exact moment something occurs. For those you should specify an offset like
-07:00
, or aZ
to indicate UTC.Where an unspecified value might have legitimate usage:
When scheduling future events by recurrence pattern, and paired with a time zone (such as
America/New_York
). For details, see other answers of mine here, here, and here.When referring to a "floating" time, that might be at a different instantaneous moment in multiple time zones. Example: A network television show that starts at 7:00 PM. The Eastern US would see it before the Western US, but it still airs at the same "floating" time in each zone.
When the time zone is already known by some other mechanism, and there is no risk of daylight saving time ambiguity, or when the risk is accepted and determined inconsequential.
In XSD 1.0, sec. 3.2.7 says (sec. "untimezoned times are presumed to be the time in the timezone of some unspecified locality". That seems to me a pretty clear indication that they don't default to UTC for validation purposes, and also that they don't default to local time for any fixed locality (e.g. the server's time). Sec. 3.2.7.4 describes (in some detail and at tedious length) that the ordering relation on dateTime is a partial order, not a total order, because (for example) the untimezoned value 2000-01-20T12:00:00 is neither definitely earlier than, nor definitely later than, nor definitely equal to, 2000-01-20T12:00:00Z.
XSD 1.1 revises the text of the discussion a good deal, but it comes to the same thing.
I believe that this is consistent with the rules in ISO 8601.
What an application makes of untimezoned values, and what other specs do with them, is a separate issue, to be answered application by application and spec by spec. But for XSD purposes, it's clear that there is no default timezone.