问题
I received some xml data that includes a timestamp taken at midnight of the application's local time in the xml schema standard dateTime format (see http://www.w3.org/TR/xmlschema-2/#dateTime for reference).
The timestamp is: 2012-02-04T13:00:00Z
Based on information I've been able to find, the relevant timezone is '(GMT+13:00) Nukualofa' which corresponds to the location 'Pacific/Tongatapu'. We are only supposed to be receiving data with timestamps that correspond to timezones/locations applicable to the contiguous 48 US states, so I am bewildered as to what timezone/location corresponds to the timestamp.
My question is, based on a dateTime of 2012-02-04T13:00:00Z, what UTC timezone, location on earth, etc. does it correspond?
回答1:
I think that your interpretation might be off; I can't see how you ended up with GMT+13:00 from 13:00:00Z.
The XSD spec gives the following example:
2002-10-10T12:00:00+05:00 is 2002-10-10T07:00:00Z
2002-10-10T00:00:00+05:00 is 2002-10-09T19:00:00Z
A nonnegative duration means that the time zone is ahead; negative is behind.
Assuming that the timestamp was taken at midnight (12:00AM), and it matched 13:00:00Z, then you could offset this either ahead or behind:
Behind: 2012-02-04T00:00:00-13:00 is 2012-02-04T13:00:00Z
Ahead: 2012-02-05T00:00:00+11:00 is 2012-02-04T13:00:00Z
The only one valid is the ahead (there is no -13); As to what is in that time zone, take a look here.
来源:https://stackoverflow.com/questions/9950406/xml-schema-timezone