3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Europe/London'); $now = new DateTime; $utc = clone $now; $now->setTimezone(new DateTimeZone('UTC')); // utc echo "UTC: {$utc->format('Y-m-d H:i')}\n"; // local echo "Local: {$now->format('Y-m-d H:i')}\n\n"; var_dump($utc->format('U') == $now->format('U'));
based on H4d95
Output for 5.3.19 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
UTC: 2015-10-22 14:50 Local: 2015-10-22 13:50 bool(true)
Output for 7.0.6
UTC: 2016-05-03 00:16 Local: 2016-05-02 23:16 bool(true)
Output for 7.0.5
UTC: 2016-04-02 13:36 Local: 2016-04-02 12:36 bool(true)
Output for 7.0.4
UTC: 2016-03-09 22:37 Local: 2016-03-09 22:37 bool(true)
Output for 7.0.3
UTC: 2016-03-17 23:03 Local: 2016-03-17 23:03 bool(true)
Output for 7.0.2
UTC: 2016-03-21 09:44 Local: 2016-03-21 09:44 bool(true)
Output for 7.0.1
UTC: 2016-03-23 09:54 Local: 2016-03-23 09:54 bool(true)
Output for 7.0.0
UTC: 2016-03-26 12:24 Local: 2016-03-26 12:24 bool(true)
Output for 5.6.21
UTC: 2016-05-01 19:21 Local: 2016-05-01 18:21 bool(true)
Output for 5.6.20
UTC: 2016-04-09 08:51 Local: 2016-04-09 07:51 bool(true)
Output for 5.6.19
UTC: 2016-03-06 20:26 Local: 2016-03-06 20:26 bool(true)
Output for 5.6.18
UTC: 2016-03-14 08:33 Local: 2016-03-14 08:33 bool(true)
Output for 5.6.17
UTC: 2016-03-19 03:37 Local: 2016-03-19 03:37 bool(true)
Output for 5.6.16
UTC: 2016-03-27 14:15 Local: 2016-03-27 13:15 bool(true)
Output for 5.6.15
UTC: 2016-03-28 15:10 Local: 2016-03-28 14:10 bool(true)
Output for 5.6.14
UTC: 2016-04-01 17:51 Local: 2016-04-01 16:51 bool(true)
Output for 5.6.13
UTC: 2016-04-14 21:39 Local: 2016-04-14 20:39 bool(true)
Output for 5.6.12
UTC: 2016-04-19 10:44 Local: 2016-04-19 09:44 bool(true)
Output for 5.6.11
UTC: 2016-04-22 18:01 Local: 2016-04-22 17:01 bool(true)
Output for 5.6.10
UTC: 2016-04-24 19:41 Local: 2016-04-24 18:41 bool(true)
Output for 5.6.9
UTC: 2016-04-27 00:46 Local: 2016-04-26 23:46 bool(true)
Output for 5.6.8
UTC: 2016-04-29 08:20 Local: 2016-04-29 07:20 bool(true)
Output for 5.6.7
UTC: 2016-05-24 18:27 Local: 2016-05-24 17:27 bool(true)
Output for 5.5.35
UTC: 2016-05-21 22:33 Local: 2016-05-21 21:33 bool(true)
Output for 5.5.34
UTC: 2016-04-10 14:44 Local: 2016-04-10 13:44 bool(true)
Output for 5.5.33
UTC: 2016-03-08 09:52 Local: 2016-03-08 09:52 bool(true)
Output for 5.5.32
UTC: 2016-03-15 18:50 Local: 2016-03-15 18:50 bool(true)
Output for 5.5.31
UTC: 2016-03-20 06:31 Local: 2016-03-20 06:31 bool(true)
Output for 5.5.30
UTC: 2016-03-31 17:13 Local: 2016-03-31 16:13 bool(true)
Output for 5.5.29
UTC: 2016-04-16 11:43 Local: 2016-04-16 10:43 bool(true)
Output for 5.5.28
UTC: 2016-04-20 13:55 Local: 2016-04-20 12:55 bool(true)
Output for 5.5.27
UTC: 2016-04-21 16:33 Local: 2016-04-21 15:33 bool(true)
Output for 5.5.26
UTC: 2016-04-25 21:55 Local: 2016-04-25 20:55 bool(true)
Output for 5.5.25
UTC: 2016-04-28 04:03 Local: 2016-04-28 03:03 bool(true)
Output for 5.5.24
UTC: 2016-04-30 11:39 Local: 2016-04-30 10:39 bool(true)