是否允许与 UTC 的零差异作为 ISO8601 中的时区指示符

Are zero differences to UTC allowed as a timezone indicator in ISO8601

我的假设是否正确,即 ISO8601 不允许与 UTC 的零差异作为时区指示符(在本例中为 GMT),但需要使用 Z 指示符?

我想就

的解释征求第二意见

The zone designator is empty if use is made of local time of the day in accordance with 5.3.1.1 through 5.3.1.3, it is the UTC designator [Z] if use is made of UTC in accordance with 5.3.3 and it is the difference-component if use is made of local time and the difference with UTC in accordance with 5.3.4.2.

因为我担心有人会争辩说如果我不想标准化时间但想表明这是使用的本地时间,您仍然可以使用 5.3.4.2

那么 1985-04-12T10:15:30+00:00 是符合 ISO8601 的有效字符串还是仅 1985-04-12T10:15:30Z 有效?

An offset of zero, in addition to having the special representation "Z", can also be stated numerically as "+00:00", "+0000", or "+00". However, it is not permitted to state it numerically with a negative sign, as "−00:00", "−0000", or "−00".

我引用了the Wikipedia article on ISO 8601。我不能保证解释正确,但至少已经很清楚了。

如果是我,我可能会采取安全的赌注:始终生成 Z,但在我接收和解析的内容中允许正零差异。

看完@Ole V.V。回答 我看到维基百科指的是更新版本的 ISO 8601。在阅读了 2016 年更新的草案后,我发现:

4.2.5.1 Difference between local time and UTC of day When it is required to indicate the difference between local time and UTC of day, the representation of the difference can be expressed in hours and minutes, or hours only. It shall be expressed as positive (i.e. with the leading plus sign [+]) if the local time is ahead of or equal to UTC of day and as negative (i.e. with the leading minus sign [-]) if it is behind UTC of day.

(ISO/TC 154/WG 5 N0038 ISO/WD 8601-1 2016-02-16 )

显然展位 1985-04-12T10:15:30+00:00 和 1985-04-12T10:15:30Z 是有效的 但 1985-04-12T10: 15:30-00:00 不是。