gpt4 book ai didi

没有时区组件的日期时间 ISO 8601

转载 作者:行者123 更新时间:2023-12-02 21:10:22 25 4
gpt4 key购买 nike

我一直在为我们的国际应用程序解析日期时间字符串。我遇到了一个解释问题,我似乎无法找到明确的答案。 不带时区部分的 ISO 8601 日期时间字符串是否应被视为本地时间?

wikipedia (我不想以此为基础进行业务决策):

If no UTC relation information is given with a time representation, the time is assumed to be in local time.

但是,我无法通过 ISO 或任何其他普遍接受的事实来源找到支持文档。我发现的所有内容都涉及如何处理本地时间的偏移(例如+/- 0500等)。在这些情况下假设本地时间会对我有很大帮助,因为我的用户可以为所有区域提交相同的日期,而无需计算每个区域的具体偏移量。

例如:

2012-01-01T00:00:00 # Convert to local
2012-01-01T00:00:00Z # Zulu/UTC...don't convert

对于无时区的 ISO 8601 字符串是否有既定的解释?

最佳答案

ISO 8601 第 4.2.2 节给出了没有 TZ 指示符的示例,表明它们是本地时间。 4.2.4 表示 UTC 时间使用“Z”指示符。当然,它总是会提出这样的问题:“本地时间在哪里?”...

The zone designator is empty if use is made of local time in accordance with 4.2.2.2 through 4.2.2.4, it is the UTC designator [Z] if use is made of UTC of day in accordance with 4.2.4 and it is the difference-component if use is made of local time and the difference from UTC in accordance with 4.2.5.2.

关于没有时区组件的日期时间 ISO 8601,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33114386/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com