I get the time:
0001-01-01T00:00:00.000Z
Greenwich Mean Time
I save this in a DateTime as:
$event->startTime = new DateTime($item->startTime, new DateTimeZone('GMT'));
What gives me:
protected 'startTime' =>
object(DateTime)[137]
public 'date' => string '0001-01-01 00:00:00' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
This means that it ignores the time zone. From the docs:
Note:
The $ timezone parameter and the current time zone are ignored when the $ time parameter is a UNIX timestamp (for example, @ 946684800) or indicates a time zone (for example, 2010-01-28T15: 00: 00 + 02 :. 00)
If I then redefine it:
$event->startTime->setTimezone(new DateTimeZone('GMT'));
I get:
protected 'startTime' =>
object(DateTime)[137]
public 'date' => string '0001-01-01 00:00:00' (length=19)
public 'timezone_type' => int 3
public 'timezone' => string 'UTC' (length=3)
So the answer says that the time zone should be GMT / UCT, which is +0, but PHP solves tl; dr , and I get my php.ini timezone by default +2. Is that not so?
, , . : UCT? , DateTime:: diff?