OffsetDateTime 中的 Z 偏移是什么?

What is Z offset in OffsetDateTime?

这两个 OffsetDateTime 返回不同的字符串表示形式和不同的偏移量。

触发时间是在不同的服务中创建的,也是通过OffsetDateTime.now()然后通过RabbitMQ发送的。

这些只是 ISO-8601 格式的不同表现形式吗?还是我缺少有效的偏移值?

我检查了 OffsetDateTime.toString() docu,但不确定那是否真的是我应该看的地方...

谢谢大家!

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

这通常被称为 Zulu 时间,参见 wikipedia 的 UTC 和 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 表示具有 zero 偏移量的 UTC 时间戳。