3v4l.org

run code in 300+ PHP versions simultaneously
<?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"));
Output for 5.6.28, 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 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.5.37, 5.6.0 - 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 )

preferences:
50.75 ms | 409 KiB | 5 Q