<?php
\date_default_timezone_set('Europe/Berlin');
$dateTime = new \DateTime('2016-08-25 12:00:00', new \DateTimeZone('UTC'));
\var_dump($dateTime, date('Y-m-d H:i:s', $dateTime->getTimestamp()), \date_default_timezone_get());
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- object(DateTime)#1 (3) {
["date"]=>
string(26) "2016-08-25 12:00:00.000000"
["timezone_type"]=>
int(3)
["timezone"]=>
string(3) "UTC"
}
string(19) "2016-08-25 14:00:00"
string(13) "Europe/Berlin"
preferences:
147.38 ms | 408 KiB | 5 Q