3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new DateTimeImmutable('-3 days'); $b = new DateTimeImmutable('now'); $c = new DateTimeImmutable('-1 day'); var_dump($a->format('Y-m-d H:i:s')); var_dump($b->format('Y-m-d H:i:s')); var_dump($c->format('Y-m-d H:i:s'));
based on YYkDS
Output for 5.6.28, 7.0.20 - 7.2.0
string(19) "2015-11-15 11:46:02" string(19) "2015-11-18 11:46:02" string(19) "2015-11-17 11:46:02"
Output for 7.0.6
string(19) "2016-04-30 18:59:23" string(19) "2016-05-03 18:59:23" string(19) "2016-05-02 18:59:23"
Output for 7.0.5
string(19) "2016-03-31 07:23:19" string(19) "2016-04-03 07:23:19" string(19) "2016-04-02 07:23:19"
Output for 7.0.4
string(19) "2016-03-07 19:12:58" string(19) "2016-03-10 19:12:58" string(19) "2016-03-09 19:12:58"
Output for 7.0.3
string(19) "2016-03-15 20:26:19" string(19) "2016-03-18 20:26:19" string(19) "2016-03-17 20:26:19"
Output for 7.0.2
string(19) "2016-03-20 02:33:58" string(19) "2016-03-23 02:33:58" string(19) "2016-03-22 02:33:58"
Output for 7.0.1
string(19) "2016-03-21 06:06:45" string(19) "2016-03-24 06:06:45" string(19) "2016-03-23 06:06:45"
Output for 7.0.0
string(19) "2016-03-24 08:02:17" string(19) "2016-03-27 08:02:17" string(19) "2016-03-26 08:02:17"
Output for 5.6.21
string(19) "2016-04-29 14:08:20" string(19) "2016-05-02 14:08:20" string(19) "2016-05-01 14:08:20"
Output for 5.6.20
string(19) "2016-04-07 06:22:50" string(19) "2016-04-10 06:22:50" string(19) "2016-04-09 06:22:50"
Output for 5.6.19
string(19) "2016-03-05 03:24:22" string(19) "2016-03-08 03:24:22" string(19) "2016-03-07 03:24:22"
Output for 5.6.18
string(19) "2016-03-12 12:11:10" string(19) "2016-03-15 12:11:10" string(19) "2016-03-14 12:11:10"
Output for 5.6.17
string(19) "2016-03-16 23:47:24" string(19) "2016-03-19 23:47:24" string(19) "2016-03-18 23:47:24"
Output for 5.6.16
string(19) "2016-03-25 08:49:32" string(19) "2016-03-28 08:49:32" string(19) "2016-03-27 08:49:32"
Output for 5.6.15
string(19) "2016-03-26 09:40:06" string(19) "2016-03-29 09:40:06" string(19) "2016-03-28 09:40:06"
Output for 5.6.14
string(19) "2016-03-30 11:29:37" string(19) "2016-04-02 11:29:37" string(19) "2016-04-01 11:29:37"
Output for 5.6.13
string(19) "2016-04-12 15:58:08" string(19) "2016-04-15 15:58:08" string(19) "2016-04-14 15:58:08"
Output for 5.6.12
string(19) "2016-04-17 06:26:43" string(19) "2016-04-20 06:26:43" string(19) "2016-04-19 06:26:43"
Output for 5.6.11
string(19) "2016-04-21 12:50:02" string(19) "2016-04-24 12:50:02" string(19) "2016-04-23 12:50:02"
Output for 5.6.10
string(19) "2016-04-22 14:51:47" string(19) "2016-04-25 14:51:47" string(19) "2016-04-24 14:51:47"
Output for 5.6.9
string(19) "2016-04-24 20:02:04" string(19) "2016-04-27 20:02:04" string(19) "2016-04-26 20:02:04"
Output for 5.6.8
string(19) "2016-04-27 04:54:37" string(19) "2016-04-30 04:54:37" string(19) "2016-04-29 04:54:37"
Output for 5.5.35
string(19) "2016-05-19 22:13:15" string(19) "2016-05-22 22:13:15" string(19) "2016-05-21 22:13:15"
Output for 5.5.34
string(19) "2016-04-08 08:34:23" string(19) "2016-04-11 08:34:23" string(19) "2016-04-10 08:34:23"
Output for 5.5.33
string(19) "2016-03-06 06:11:29" string(19) "2016-03-09 06:11:29" string(19) "2016-03-08 06:11:29"
Output for 5.5.32
string(19) "2016-03-14 16:04:10" string(19) "2016-03-17 16:04:10" string(19) "2016-03-16 16:04:10"
Output for 5.5.31
string(19) "2016-03-18 02:51:02" string(19) "2016-03-21 02:51:02" string(19) "2016-03-20 02:51:02"
Output for 5.5.30
string(19) "2016-03-29 11:33:47" string(19) "2016-04-01 11:33:47" string(19) "2016-03-31 11:33:47"
Output for 5.5.29
string(19) "2016-04-14 06:19:31" string(19) "2016-04-17 06:19:31" string(19) "2016-04-16 06:19:31"
Output for 5.5.28
string(19) "2016-04-18 09:41:02" string(19) "2016-04-21 09:41:02" string(19) "2016-04-20 09:41:02"
Output for 5.5.27
string(19) "2016-04-19 11:26:20" string(19) "2016-04-22 11:26:20" string(19) "2016-04-21 11:26:20"
Output for 5.5.26
string(19) "2016-04-23 17:34:55" string(19) "2016-04-26 17:34:55" string(19) "2016-04-25 17:34:55"
Output for 5.5.25
string(19) "2016-04-26 00:33:18" string(19) "2016-04-29 00:33:18" string(19) "2016-04-28 00:33:18"
Output for 5.5.24
string(19) "2016-05-21 06:59:45" string(19) "2016-05-24 06:59:45" string(19) "2016-05-23 06:59:45"
Output for 5.3.19 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/isnEM on line 3
Process exited with code 255.