3v4l.org

run code in 300+ PHP versions simultaneously
<?php $UTC_offset = '+03:30'; $utc = new \DateTimeZone('UTC'); $date = new \DateTime('now', $utc); var_dump($date); $timezone = new \DateTimeZone(str_replace(':', '', $UTC_offset)); $date->setTimezone($timezone); var_dump($date);
Output for git.master
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.003530" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.003530" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for git.master_jit
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.003814" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.003814" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }
Output for rfc.property-hooks
object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 06:26:18.003568" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } object(DateTime)#2 (3) { ["date"]=> string(26) "2016-01-15 09:56:18.003568" ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+03:30" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.71 ms | 401 KiB | 8 Q