gpt4 book ai didi

php - UNIX 时间戳(0) : Europe/London returns UTC+1

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:03:12 24 4
gpt4 key购买 nike

学习约会,他们现在让我很难受。

$london = new DateTime();
$london->setTimestamp(0);
$london->setTimeZone(new DateTimeZone('Europe/London'));

echo $london ->format('d-m-Y H-i-s');

结果:

01-01-1970 01-00-00

UTC +0:00 不应该是伦敦,所以是午夜?例如,纽约返回前一个日期的 19:00,这是正确的 UTC -5:00。莫斯科返回 01-01-1970 03-00-00 这又是不正确的(UTC +3:00 而不是 UTC +4:00)

不过,当不使用 ->setTimestamp 时,伦敦当前时间会正确呈现。

直播码:http://sandbox.onlinephpfunctions.com/

此外,我本地的时区是欧洲/布拉格 (UTC +1:00)。也使用 date_default_timezone_set('Europe/London') 进行了测试。

我想我的逻辑有问题吗?

最佳答案

这是因为显然,英国在 British Summer Time 上1970 年 1 月 1 日,比 UTC 早一小时(强调我的):

An inquiry during the winter of 1959–60, in which 180 national organisations were consulted, revealed a slight preference for a change to all-year GMT+1, but the length of summer time was extended as a trial rather than the domestic use of Greenwich Mean Time abolished.[6] A further inquiry during 1966–67 led the government of Harold Wilson to introduce the British Standard Time experiment, with Britain remaining on GMT+1 throughout the year. This took place between 27 October 1968 and 31 October 1971, when there was a reversion to the previous arrangement.

timeanddate.com 的 Time Zone Converter是查找此类内容的绝佳工具。

关于php - UNIX 时间戳(0) : Europe/London returns UTC+1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14911078/

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