gpt4 book ai didi

PHP 日期 ISO 8601 日期 时区

转载 作者:行者123 更新时间:2023-11-29 01:55:27 27 4
gpt4 key购买 nike

我从支付网关返回了这个日期

2014-05-15T08:40:52+01:00

我得到 2014-05-15T08:40:52 但我无法识别时区 +01:00 的含义

我的位置时区是 UTC−06:00 (CT)

服务器位置时区为 UTC−02:00

我的支付网关时区 UTC−05:00 (EST)

+01:00 添加/不添加到我的时区后的含义是什么?我如何告诉我的网站用户他/她在 XX 日期和时间成功完成了付款过程...

最佳答案

ISO 8601 Specs

The formats are as follows. Exactly the components shown here must be present, with exactly this punctuation. Note that the "T" appears literally in the string, to indicate the beginning of the time element, as specified in ISO 8601.

   Year:
YYYY (eg 1997)
Year and month:
YYYY-MM (eg 1997-07)
Complete date:
YYYY-MM-DD (eg 1997-07-16)
Complete date plus hours and minutes:
YYYY-MM-DDThh:mmTZD (eg 1997-07-16T19:20+01:00)
Complete date plus hours, minutes and seconds:
YYYY-MM-DDThh:mm:ssTZD (eg 1997-07-16T19:20:30+01:00)
Complete date plus hours, minutes, seconds and a decimal fraction of a second
YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)

where:

     YYYY = four-digit year
MM = two-digit month (01=January, etc.)
DD = two-digit day of month (01 through 31)
hh = two digits of hour (00 through 23) (am/pm NOT allowed)
mm = two digits of minute (00 through 59)
ss = two digits of second (00 through 59)
s = one or more digits representing a decimal fraction of a second
TZD = time zone designator (Z or +hh:mm or -hh:mm)

This profile defines two ways of handling time zone offsets:

1.Times are expressed in UTC (Coordinated Universal Time), with a special UTC designator ("Z").

2.Times are expressed in local time, together with a time zone offset in hours and minutes.

A time zone offset of "+hh:mm" indicates that the date/time uses a local time zone which is "hh" hours and "mm" minutes ahead of UTC.

A time zone offset of "-hh:mm" indicates that the date/time uses a local time zone which is "hh" hours and "mm" minutes behind UTC.

这部分回答你的问题

A time zone offset of "+hh:mm" indicates that the date/time uses a local time zone which is "hh" hours and "mm" minutes ahead of UTC.

长话短说

无论您服务器上的时间和支付网关上的时间是什么时间,您所看到的日期都位于比 UTC 早 1 小时的时区内。它返回的时间比世界任何地方和任何时区的 UTC 时间早 1 小时。

关于PHP 日期 ISO 8601 日期 时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30390784/

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