3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dt = new DateTime('2021-11-25 16:46:15'); var_dump($dt->format('Y-m-d H:i:s')); $dt->setTimeZone(new DateTimeZone('+0100')); var_dump($dt->format('Y-m-d H:i:s')); $dt->setTimeZone(new DateTimeZone('-0600')); var_dump($dt->format('Y-m-d H:i:s')); $dt->setTimeZone(new DateTimeZone('UTC')); var_dump($dt->format('Y-m-d H:i:s'));
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.26, 8.0.0 - 8.0.13, 8.1rc1 - rc3
string(19) "2021-11-25 16:46:15" string(19) "2021-11-25 16:46:15" string(19) "2021-11-25 09:46:15" string(19) "2021-11-25 15:46:15"

preferences:
18.69 ms | 460 KiB | 5 Q