3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // set to UTC date_default_timezone_set('UTC'); $bratislavaTimezone = new DateTimeZone('Europe/Bratislava'); $utcTimezone = new DateTimeZone('UTC'); $now = new DateTime(); $now->setTime(23, 59, 59); echo $now->format("Y-m-d H:i:s\n"); $bratislava = clone $now; $bratislava->setTimezone($bratislavaTimezone); echo $bratislava->format("Y-m-d H:i:s\n"); $start = (clone $bratislava)->setTime(0, 0, 0); $end = (clone $bratislava)->setTime(23, 59, 59); echo $start->format("Y-m-d H:i:s\n"); echo $end->format("Y-m-d H:i:s\n"); // convert back to UTC $start->setTimezone($utcTimezone); $end->setTimezone($utcTimezone); echo $start->format("Y-m-d H:i:s\n"); echo $end->format("Y-m-d H:i:s\n");
based on 33bqh
Output for 7.0.14 - 7.1.0
2014-10-05 23:59:59 2014-10-06 01:59:59 2014-10-06 00:00:00 2014-10-06 23:59:59 2014-10-05 22:00:00 2014-10-06 21:59:59
Output for 7.0.6
2016-05-03 23:59:59 2016-05-04 01:59:59 2016-05-04 00:00:00 2016-05-04 23:59:59 2016-05-03 22:00:00 2016-05-04 21:59:59
Output for 7.0.5
2016-04-02 23:59:59 2016-04-03 01:59:59 2016-04-03 00:00:00 2016-04-03 23:59:59 2016-04-02 22:00:00 2016-04-03 21:59:59
Output for 7.0.4
2016-03-10 23:59:59 2016-03-11 00:59:59 2016-03-11 00:00:00 2016-03-11 23:59:59 2016-03-10 23:00:00 2016-03-11 22:59:59
Output for 7.0.3
2016-03-18 23:59:59 2016-03-19 00:59:59 2016-03-19 00:00:00 2016-03-19 23:59:59 2016-03-18 23:00:00 2016-03-19 22:59:59
Output for 7.0.2
2016-03-22 23:59:59 2016-03-23 00:59:59 2016-03-23 00:00:00 2016-03-23 23:59:59 2016-03-22 23:00:00 2016-03-23 22:59:59
Output for 7.0.1
2016-03-23 23:59:59 2016-03-24 00:59:59 2016-03-24 00:00:00 2016-03-24 23:59:59 2016-03-23 23:00:00 2016-03-24 22:59:59
Output for 7.0.0
2016-03-26 23:59:59 2016-03-27 00:59:59 2016-03-27 00:00:00 2016-03-27 23:59:59 2016-03-26 23:00:00 2016-03-27 21:59:59
Output for hhvm-3.12.0
2016-03-12 23:59:59 2016-03-13 00:59:59 2016-03-13 00:00:00 2016-03-13 23:59:59 2016-03-12 23:00:00 2016-03-13 22:59:59
Output for hhvm-3.10.0
2016-03-30 23:59:59 2016-03-31 01:59:59 2016-03-31 00:00:00 2016-03-31 23:59:59 2016-03-30 22:00:00 2016-03-31 21:59:59
Output for 5.4.0 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR) in /in/PtXCi on line 20
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/PtXCi on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/PtXCi on line 20
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/PtXCi on line 15
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/PtXCi on line 15
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/PtXCi on line 15
Process exited with code 255.