How to recognize UTC dateTime in XML?

1
Hi guys. In response to a service call, my app receives XML messages from different APIs. The XML contains, among others, a dateTime element. Now, some of APIs return dateTime with timeZone (example: <Time>2018-08-17T09:30:47Z</Time>) and some without time zone (example: <Time>2018-10-17T08:00:00</Time>. I process all of these XMLs in same mapping, but I need to distinguish between UTC dateTime and non-UTC. So, how can I possibly find out the difference? Thanks.
asked
1 answers
1

According to the  ISO 8601 UTC can be recognized if there is a Z directly after the time.

 

If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "0930Z". "14:45:15 UTC" would be "14:45:15Z" or "144515Z".

The Z suffix in the ISO 8601 time representation is sometimes referred to as "Zulu time" because the same letter is used to designate the Zulu time zone. However the ACP 121 standard that defines the list of military time zones makes no mention of UTC and derives the "Zulu time" from the Greenwich Mean Time[27] which was formerly used as the international civil time standard. GMT is no longer precisely defined by the scientific community and can refer to either UTC or UT1 depending on context.[28] 

Regards,

Ronald

 

answered