3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = '2015-01-01 13:45:18'; date_default_timezone_set('Europe/Sofia'); $date1= new DateTime($date); var_dump($date1); var_dump($date1->format('Y-m-d H:i:s')); var_dump($date1->getTimestamp()); var_dump($date1->getTimezone()); date_default_timezone_set('UTC'); $date2= new DateTime($date); var_dump($date2); var_dump($date2->format('Y-m-d H:i:s')); var_dump($date2->getTimestamp()); var_dump($date2->getTimezone());
based on I9j03
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.2.6
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-01-01 13:45:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Sofia" } string(19) "2015-01-01 13:45:18" int(1420112718) object(DateTimeZone)#2 (2) { ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Sofia" } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-01-01 13:45:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(19) "2015-01-01 13:45:18" int(1420119918) object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for hhvm-3.15.4
object(DateTime)#1 (3) { ["date"]=> string(26) "2015-01-01 13:45:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Europe/Sofia" } string(19) "2015-01-01 13:45:18" int(1420112718) object(DateTimeZone)#2 (0) { } object(DateTime)#2 (3) { ["date"]=> string(26) "2015-01-01 13:45:18.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } string(19) "2015-01-01 13:45:18" int(1420119918) object(DateTimeZone)#3 (0) { }