3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo date_default_timezone_get(), PHP_EOL; echo PHP_EOL, 'time()', PHP_EOL; $timestamp = strtotime('15:00 01-02-2016'); echo date('H:i:sP', $timestamp); echo $timestamp, PHP_EOL; echo PHP_EOL, 'DateTime1', PHP_EOL; $dateTime = new DateTime('@' . $timestamp); echo $dateTime->getTimestamp(), PHP_EOL, $dateTime->format('H:i:sP'), PHP_EOL; echo PHP_EOL, 'DateTime2', PHP_EOL; $dateTime = new DateTime('@' . $timestamp); $dateTime->setTimezone(new DateTimeZone(date_default_timezone_get())); echo $dateTime->getTimestamp(), PHP_EOL, $dateTime->format('H:i:sP'), PHP_EOL; echo $dateTime->getDay();
based on gv8gM
Output for 7.0.0 - 7.2.0
Europe/Amsterdam time() 15:00:00+01:001454335200 DateTime1 1454335200 14:00:00+00:00 DateTime2 1454335200 15:00:00+01:00 Fatal error: Uncaught Error: Call to undefined method DateTime::getDay() in /in/EjgMm:20 Stack trace: #0 {main} thrown in /in/EjgMm on line 20
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Europe/Amsterdam time() 15:00:00+01:001454335200 DateTime1 1454335200 14:00:00+00:00 DateTime2 1454335200 15:00:00+01:00 Fatal error: Call to undefined method DateTime::getDay() in /in/EjgMm on line 20
Process exited with code 255.