3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $winter = new DateTime('2010-12-21', new DateTimeZone('Europe/Zurich')); $summer = new DateTime('2008-06-21', new DateTimeZone('Europe/Zurich')); $summer2 = new DateTime('2008-06-21T12:14:12+0100', new DateTimeZone('Europe/Zurich')); echo $winter->getOffset() . "\n"; echo $summer->getOffset() . "\n"; echo $summer2->getOffset() . "\n"; $summer2->setTimeZone(new DateTimeZone('Europe/Zurich')); echo $summer2->format('Ymd H:i');
based on PQmNe
Output for 5.2.6 - 7.2.0
3600 7200 3600 20080621 13:14
Output for 5.2.0 - 5.2.5
3600 7200 7200 20080621 13:14
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Lao9f on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/Lao9f on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/Lao9f on line 3