3v4l.org

run code in 300+ PHP versions simultaneously
<?php $base = 1509224400; // 2017-10-28 22:00:00 BST $intervalMins = 720; $utc = new \DateTimeZone('UTC'); $europeLondon = new \DateTimeZone('Europe/London'); // create datetime from timestamp $base = (new \DateTimeImmutable('@' . $base))->setTimeZone($utc); echo 'UTC modified: ' . $base->modify('+' . $intervalMins . ' minutes')->format('U Y-m-d H:i:s') . "\n"; echo 'Local modified: ' . $base->setTimezone($europeLondon)->modify('+' . $intervalMins . ' minutes')->format('U Y-m-d H:i:s') . "\n";
Output for 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
UTC modified: 1509267600 2017-10-29 09:00:00 Local modified: 1509271200 2017-10-29 10:00:00

preferences:
131.6 ms | 408 KiB | 5 Q