3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime('2015-11-11 15:00:00'); $date->setTimezone(new DateTimeZone('UTC')); var_dump($date); echo "\n Date timestamp using format(): " . $date->format('U'); echo "\n Date timestamp using getTimestamp(): " . $date->getTimestamp(); echo "\nChanging timezone to CET"; $date->setTimezone(new DateTimeZone('CET')); echo "\n Date timestamp using format(): " . $date->format('U') . ' NB: This has changed?!?!'; echo "\n Date timestamp using getTimestamp(): " . $date->getTimestamp() . ' NB: Now it is back?!?!'; echo "\n Date timestamp using format() again: " . $date->format('U') . ' NB: Now it is back?!?!'; ?>

preferences:
41.49 ms | 402 KiB | 5 Q