简体   繁体   English

PHP日期ISO 8601日期时区

[英]PHP date ISO 8601 date Timezone

I have this date returned from payment gateway 我有这个日期从付款网关返回

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

I got 2014-05-15T08:40:52 but i am unable to identify meaning of timezone +01:00 我有2014-05-15T08:40:52但我无法识别时区+01:00含义

My location timezone is UTC−06:00 (CT) 我的位置时区是UTC-06:00(CT)

Servers location time zone is UTC−02:00 服务器位置的时区为UTC-02:00

My payment gateway time zone UTC−05:00 (EST) 我的付款网关时区UTC-05:00(EST)

What is the meaning of +01:00 after adding/without adding it to my timezones? 在添加/不将其添加到我的时区后,+ +01:00是什么意思? How can i tell to my website user that he/she successfully completed payment process at XX date and Time... 我如何告知我的网站用户他/她已在XX日期和时间成功完成了付款过程...

ISO 8601 Specs ISO 8601规格

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. 请注意,“ T”字面意义上出现在字符串中,以指示时间元素的开始,如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"). 1.时间以UTC(世界标准时间)表示,并带有特殊的UTC标记(“ Z”)。

2.Times are expressed in local time, together with a time zone offset in hours and minutes. 2.时间以当地时间表示,时区以小时和分钟表示。

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. 时区偏移量为“ + hh:mm”表示日期/时间使用的本地时区比UTC提前“ hh”小时和“ mm”分钟。

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. 时区偏移量为“ -hh:mm”表示日期/时间使用本地时区,该时区比UTC落后“ hh”小时和“ mm”分钟。

This section answers your question 本部分回答您的问题

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. 时区偏移量为“ + hh:mm”表示日期/时间使用的本地时区比UTC提前“ hh”小时和“ mm”分钟。

TL;DR TL; DR

The date that you are seeing is in a Time Zone 1 hour ahead of UTC, regardless of what time is it at your server and what time is it at the payment gateway. 无论您的服务器上的时间是什么,支付网关上的时间是什么,您看到的日期都比UTC早1小时。 The time that it did return is 1 hour ahead of UTC which stands anywhere in the world and in any time zone. 真的回来的时间是协调世界时,其在任何地方矗立在世界上和在任何时区的1小时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM