3v4l.org

run code in 300+ PHP versions simultaneously
<?php // @see https://stackoverflow.com/questions/77131068/how-to-retain-the-time-zone-info-when-truncating-a-timestamp-with-time-zone date_default_timezone_set('UTC'); $dates = [ '1999-12-31 20:59:59+00', '1999-12-31 20:59:59', '2000-01-01 07:29:59', '1999-12-31 20:00:00+00', '1999-12-31 20:00:00', '2000-01-01 07:00:00', '2000-01-01 07:00:00 +00', '2000-01-01 07:00:00 Australia/Adelaide' ]; foreach ($dates as $dateString) { $date = new \DateTimeImmutable($dateString); echo $dateString."\n-> ".$date->format('r')."\n\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
1999-12-31 20:59:59+00 -> Fri, 31 Dec 1999 20:59:59 +0000 1999-12-31 20:59:59 -> Fri, 31 Dec 1999 20:59:59 +0000 2000-01-01 07:29:59 -> Sat, 01 Jan 2000 07:29:59 +0000 1999-12-31 20:00:00+00 -> Fri, 31 Dec 1999 20:00:00 +0000 1999-12-31 20:00:00 -> Fri, 31 Dec 1999 20:00:00 +0000 2000-01-01 07:00:00 -> Sat, 01 Jan 2000 07:00:00 +0000 2000-01-01 07:00:00 +00 -> Sat, 01 Jan 2000 07:00:00 +0000 2000-01-01 07:00:00 Australia/Adelaide -> Sat, 01 Jan 2000 07:00:00 +1030

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:
32.05 ms | 406 KiB | 5 Q