3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo date_default_timezone_get(); // prints Europe/Amsterdam echo "\n\n"; $dateTime = new DateTime('2016-10-29 10:00:00'); echo $dateTime->format(DateTime::RFC3339); echo "\n"; $dateTime->add(new DateInterval('PT23H')); echo $dateTime->format(DateTime::RFC3339); // prints 2016-10-30T08:00:00+01:00 echo "\n\n"; $dateTime = new DateTime('2016-10-29 10:00:00'); echo $dateTime->format(DateTime::RFC3339); echo "\n"; $dateTime->modify('+ 23 hours'); echo $dateTime->format(DateTime::RFC3339); // prints 2016-10-30T09:00:00+01:00 echo "\n\n";
Output for 5.5.8 - 5.5.36, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.8
Europe/Amsterdam 2016-10-29T10:00:00+02:00 2016-10-30T08:00:00+01:00 2016-10-29T10:00:00+02:00 2016-10-30T09:00:00+01:00
Output for 7.3.32 - 7.3.33, 8.0.13
UTC 2016-10-29T10:00:00+00:00 2016-10-30T09:00:00+00:00 2016-10-29T10:00:00+00:00 2016-10-30T09:00:00+00:00
Output for 5.5.0 - 5.5.7
Europe/Amsterdam 2016-10-29T10:00:00+02:00 2016-10-30T09:00:00+01:00 2016-10-29T10:00:00+02:00 2016-10-30T09:00:00+01:00

preferences:
171.06 ms | 402 KiB | 234 Q