3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tz = new DateTimeZone('America/Chicago'); // A timezone that has DST $five_hours_interval = new DateInterval('PT5H'); $date = new DateTime("2020-03-08 00:00:00", $tz); // goes forward at 2am echo $date->format('c') . "\n"; // Add five hours and subtract 5 hours. The $newDate should then equal the date. $five_hours_later = $date->add($five_hours_interval); $newDate = $five_hours_later->sub($five_hours_interval); echo $newDate->format('c');

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
212.5 ms | 2109 KiB | 8 Q