What is Z offset in OffsetDateTime? [duplicate]
Asked Answered
P

1

7

These two OffsetDateTime are returning a different String representation and different offsets.

The trigger time was created in a different service, but also through OffsetDateTime.now() and then send over RabbitMQ.

Are these just a different representations of the ISO-8601 format? Or am I missing a valid offset value ?

I checked the OffsetDateTime.toString() docu, but not sure if that is really where I should be looking...

Thanks everyone!

OffsetDateTime offsetDateTime = event.getTriggerTime();

System.out.println(offsetDateTime); //2019-06-19T08:56:19.152564Z
System.out.println(OffsetDateTime.now()); //2019-06-19T10:56:19.293893+02:00
Poindexter answered 19/6, 2019 at 9:8 Comment(1)
Though the linked question is not identical to yours, I believe the answers there answer your question too. You may search for more questions and answers and web sites that treat Z as offset.Renegado
M
10

That is often referred to as Zulu time, see wikipedia for UTC and ISO 8601:

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 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.

TL;DR: Z denotes a UTC timestamp with zero offset.

Meadowlark answered 19/6, 2019 at 9:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.