3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $timestamp = new DateTime('2014-08-19 00:30:00', new DateTimeZone('Europe/Dublin')); // time when you fetched the UTC time ^^^^^^^^ $timestamp->setTimezone(new DateTimeZone('UTC')); $timestamp->setTime($hours, $minutes, $seconds); echo $timestamp->format('Y-m-d H:i:s');
based on bObBP
Output for 5.2.0 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
Notice: Undefined variable: hours in /in/RDHb5 on line 6 Notice: Undefined variable: minutes in /in/RDHb5 on line 6 Notice: Undefined variable: seconds in /in/RDHb5 on line 6 2014-08-18 00:00:00
Output for hhvm-3.12.0
Notice: Undefined variable: hours in /in/RDHb5 on line 6 Notice: Undefined variable: minutes in /in/RDHb5 on line 6 Notice: Undefined variable: seconds in /in/RDHb5 on line 6 Warning: setTime() expects parameter 1 to be integer, null given in /in/RDHb5 on line 6 2014-08-18 23:30:00
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/RDHb5 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/RDHb5 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/RDHb5 on line 3