3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime; $departure = $now->modify('+42 hours'); echo $now->format('Y-m-d H:i:s') . PHP_EOL; echo $departure->format('Y-m-d H:i:s') . PHP_EOL; echo $now->diff($departure)->format('%h') . PHP_EOL;
based on lDkQl
Output for 5.6.28, 7.0.20 - 7.2.0
2016-01-08 06:49:50 2016-01-08 06:49:50 0
Output for 7.0.6
2016-05-23 07:24:34 2016-05-23 07:24:34 0
Output for 7.0.5
2016-04-05 03:26:15 2016-04-05 03:26:15 0
Output for 7.0.4
2016-03-12 15:32:46 2016-03-12 15:32:46 0
Output for 7.0.3
2016-03-20 16:57:00 2016-03-20 16:57:00 0
Output for 7.0.2
2016-03-24 23:10:15 2016-03-24 23:10:15 0
Output for 7.0.1
2016-03-26 02:17:12 2016-03-26 02:17:12 0
Output for 7.0.0
2016-03-29 04:10:32 2016-03-29 04:10:32 0
Output for 5.6.21
2016-05-04 10:19:18 2016-05-04 10:19:18 0
Output for 5.6.20
2016-04-12 02:28:08 2016-04-12 02:28:08 0
Output for 5.6.19
2016-03-09 23:41:06 2016-03-09 23:41:06 0
Output for 5.6.18
2016-03-17 08:38:08 2016-03-17 08:38:08 0
Output for 5.6.17
2016-03-21 20:10:36 2016-03-21 20:10:36 0
Output for 5.6.16
2016-03-30 04:59:46 2016-03-30 04:59:46 0
Output for 5.6.15
2016-03-31 05:49:05 2016-03-31 05:49:05 0
Output for 5.6.14
2016-04-16 11:31:38 2016-04-16 11:31:38 0
Output for 5.6.13
2016-04-17 12:10:41 2016-04-17 12:10:41 0
Output for 5.6.12
2016-04-22 02:39:50 2016-04-22 02:39:50 0
Output for 5.6.11
2016-04-26 09:05:59 2016-04-26 09:05:59 0
Output for 5.6.10
2016-04-27 11:11:46 2016-04-27 11:11:46 0
Output for 5.6.9
2016-04-29 16:37:51 2016-04-29 16:37:51 0
Output for 5.6.8
2016-05-02 01:07:55 2016-05-02 01:07:55 0
Output for 5.5.35
2016-05-24 20:18:27 2016-05-24 20:18:27 0
Output for 5.5.34
2016-04-13 04:42:01 2016-04-13 04:42:01 0
Output for 5.5.33
2016-03-11 02:39:57 2016-03-11 02:39:57 0
Output for 5.5.32
2016-03-19 12:34:56 2016-03-19 12:34:56 0
Output for 5.5.31
2016-03-22 23:19:33 2016-03-22 23:19:33 0
Output for 5.5.30
2016-04-03 07:41:09 2016-04-03 07:41:09 0
Output for 5.5.29
2016-04-19 02:28:30 2016-04-19 02:28:30 0
Output for 5.5.28
2016-04-23 05:58:21 2016-04-23 05:58:21 0
Output for 5.5.27
2016-04-24 07:36:50 2016-04-24 07:36:50 0
Output for 5.5.26
2016-04-28 13:52:20 2016-04-28 13:52:20 0
Output for 5.5.25
2016-04-30 21:17:59 2016-04-30 21:17:59 0
Output for 5.5.24
2016-05-26 03:41:07 2016-05-26 03:41:07 0
Output for 5.4.45
2016-01-08 06:49:54 2016-01-08 06:49:54 0
Output for 5.4.44
2016-01-08 06:49:55 2016-01-08 06:49:55 0
Output for 5.4.43
2016-01-08 06:49:56 2016-01-08 06:49:56 0
Output for 5.4.41 - 5.4.42
2016-01-08 06:49:57 2016-01-08 06:49:57 0
Output for 5.4.39 - 5.4.40
2016-01-08 06:49:58 2016-01-08 06:49:58 0
Output for 5.4.37 - 5.4.38
2016-01-08 06:49:59 2016-01-08 06:49:59 0
Output for 5.4.35 - 5.4.36
2016-01-08 06:50:00 2016-01-08 06:50:00 0
Output for 5.4.34
2016-01-08 06:50:01 2016-01-08 06:50:01 0
Output for 5.3.29, 5.4.31 - 5.4.32
2016-01-08 06:50:02 2016-01-08 06:50:02 0
Output for 5.4.27 - 5.4.30
2016-01-08 06:50:03 2016-01-08 06:50:03 0
Output for 5.4.25 - 5.4.26
2016-01-08 06:50:04 2016-01-08 06:50:04 0
Output for 5.3.28, 5.4.21 - 5.4.24
2016-01-08 06:50:05 2016-01-08 06:50:05 0
Output for 5.4.18 - 5.4.20
2016-01-08 06:50:06 2016-01-08 06:50:06 0
Output for 5.3.26 - 5.3.27, 5.4.16 - 5.4.17
2016-01-08 06:50:07 2016-01-08 06:50:07 0
Output for 5.3.23 - 5.3.25, 5.4.12 - 5.4.15
2016-01-08 06:50:08 2016-01-08 06:50:08 0
Output for 5.3.21 - 5.3.22, 5.4.11
2016-01-08 06:50:09 2016-01-08 06:50:09 0