3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('America/Los_Angeles'); $time = time(); //Qcodo version print_r(new Datetime(date('Y-m-d H:i:s', $time))); //v3 version print_r(new Datetime("@$time"));
based on 8eXhf
Output for 5.6.28, 7.0.20 - 7.2.6
DateTime Object ( [date] => 2016-03-01 20:32:46.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateTime Object ( [date] => 2016-03-02 04:32:46.000000 [timezone_type] => 1 [timezone] => +00:00 )
Output for 5.5.14 - 5.6.23, 7.0.0 - 7.0.8
DateTime Object ( [date] => 2016-03-01 20:31:55.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateTime Object ( [date] => 2016-03-02 04:31:55.000000 [timezone_type] => 1 [timezone] => +00:00 )
Output for 5.5.0 - 5.5.13
DateTime Object ( [date] => 2016-03-01 20:31:55 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateTime Object ( [date] => 2016-03-02 04:31:55 [timezone_type] => 1 [timezone] => +00:00 )