Dates of study, and they give me a hard time right now.
$london = new DateTime(); $london->setTimestamp(0); $london->setTimeZone(new DateTimeZone('Europe/London')); echo $london ->format('dmY Hi-s');
result:
01-01-1970 01-00-00
Should there be London at UTC +0:00 , so 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 in contrast to UTC +4:00 )
If you do not use ->setTimestamp , then the current time in London is displayed correctly.
Livecode: http://sandbox.onlinephpfunctions.com/
Also, my local time zone is Europe/Prague ( UTC +1:00 ). Tested with date_default_timezone_set('Europe/London') .
I assume there is an error in my logic?
source share