UNIX时间戳记(0):欧洲/伦敦返回UTC + 1

UNIX时间戳记(0):欧洲/伦敦返回UTC + 1

问题描述:

学习约会,他们现在给我很辛苦.

Learning dates and they're giving me hard time right now.

$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)

Shouldn't be London in UTC +0:00 therefore midnight? For example, New York returns 19:00 of the previous date which is correctly UTC -5:00. Moscow returns 01-01-1970 03-00-00 which is again incorrect (UTC +3:00 as opposed to UTC +4:00)

但是,当不使用->setTimestamp时,伦敦当前时间将正确呈现.

When not using ->setTimestamp, the London current time renders correctly, though.

Livecode: http://sandbox.onlinephpfunctions.com/

Livecode: http://sandbox.onlinephpfunctions.com/

此外,我的本地时区为Europe/Prague(UTC +1:00).也已通过date_default_timezone_set('Europe/London')进行了测试.

Also, my local timezone is Europe/Prague (UTC +1:00). Tested with date_default_timezone_set('Europe/London') as well.

我认为我的逻辑中有错误吗?

I presume there's some error in my logic?

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

This is because apparently, Great Britain was on British Summer Time on January 1, 1970, one hour ahead of UTC (emphasis mine):

在1959–60冬季进行的一次调查中,与180个国家组织进行了磋商,结果显示,对于改用全年GMT + 1稍有偏爱,但是夏季时间的延长是作为试验,而不是延长.格林威治标准时间的国内使用被废止.[6] 1966-67年间的进一步询问促使哈罗德·威尔逊(Harold Wilson)政府引入了英国标准时间实验,英国全年仍保留在格林尼治标准时间(GMT + 1)上.该实验发生在1968年10月27日至1971年10月31日之间,当您恢复到以前的安排时.

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的

timeanddate.com's Time Zone Converter is a great tool for finding out stuff like this.