3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vancouver = new \DateTimeZone('America/Vancouver'); $utc = new \DateTimeZone('UTC'); $timestamp1 = 1478422920; $date1 = new \DateTime('@' . $timestamp1); print '--- UTC ---' . PHP_EOL; print $timestamp1 . PHP_EOL; print $date1->format('c') . PHP_EOL; print '--- UTC => Vancouver ---' . PHP_EOL; $date1->setTimezone($vancouver); print $date1->format('c') . PHP_EOL; print $date1->format('Y-m-d\TH:i:s') . PHP_EOL; print '--- Vancouver => UTC ---' . PHP_EOL; $string1 = $date1->format('Y-m-d\TH:i:s'); $date2 = new \DateTime($string1, $vancouver); $timestamp2 = $date2->getTimestamp(); print $timestamp2 . PHP_EOL; print $date2->format('c') . PHP_EOL; $date2->setTimezone($utc); print $date2->format('c') . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
--- UTC --- 1478422920 2016-11-06T09:02:00+00:00 --- UTC => Vancouver --- 2016-11-06T01:02:00-08:00 2016-11-06T01:02:00 --- Vancouver => UTC --- 1478419320 2016-11-06T01:02:00-07:00 2016-11-06T08:02:00+00:00

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:
58.56 ms | 401 KiB | 8 Q