3v4l.org

run code in 300+ PHP versions simultaneously
<?php $original_timezone = new DateTimeZone('UTC'); $datetime = new DateTime('06-01-2016 19:00 UTC', $original_timezone); $target_timezone = new DateTimeZone('EDT'); $datetime->setTimeZone($target_timezone); $triggerOn = $datetime->format('Y-m-d h:i:s T'); echo $triggerOn; echo timezone_offset_get($target_timezone,$triggerOn);
Output for 8.0.21 - 8.0.30, 8.1.8 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
2016-01-06 03:00:00 EDT Fatal error: Uncaught TypeError: timezone_offset_get(): Argument #2 ($datetime) must be of type DateTimeInterface, string given in /in/rdVMU:9 Stack trace: #0 /in/rdVMU(9): timezone_offset_get(Object(DateTimeZone), '2016-01-06 03:0...') #1 {main} thrown in /in/rdVMU on line 9
Process exited with code 255.
Output for 8.0.0 - 8.0.20, 8.1.0 - 8.1.7
2016-01-06 02:00:00 EDT Fatal error: Uncaught TypeError: timezone_offset_get(): Argument #2 ($datetime) must be of type DateTimeInterface, string given in /in/rdVMU:9 Stack trace: #0 /in/rdVMU(9): timezone_offset_get(Object(DateTimeZone), '2016-01-06 02:0...') #1 {main} thrown in /in/rdVMU on line 9
Process exited with code 255.
Output for 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
2016-01-06 02:00:00 EDT Fatal error: Uncaught TypeError: Argument 2 passed to timezone_offset_get() must implement interface DateTimeInterface, string given in /in/rdVMU:9 Stack trace: #0 /in/rdVMU(9): timezone_offset_get(Object(DateTimeZone), '2016-01-06 02:0...') #1 {main} thrown in /in/rdVMU on line 9
Process exited with code 255.
Output for 5.5.19 - 5.5.38, 5.6.3 - 5.6.40
2016-01-06 02:00:00 EDT Warning: timezone_offset_get() expects parameter 2 to be DateTimeInterface, string given in /in/rdVMU on line 9
Output for 5.5.10 - 5.5.18, 5.6.0 - 5.6.2
2016-01-06 02:00:00 EDT Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in /in/rdVMU on line 9
Output for 5.5.0 - 5.5.9
2016-01-06 02:00:00 EST Warning: timezone_offset_get() expects parameter 2 to be DateTime, string given in /in/rdVMU on line 9

preferences:
259.49 ms | 401 KiB | 328 Q