3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d = new DateTime(); $d->modify("last day of December"); echo $d->format("Y-m-d H:i:s"); $d->setTime(24,0,0); echo $d->format("Y-m-d H:i:s");
based on TNvdm
Output for 5.6.28, 7.0.14 - 7.1.0
2014-12-31 19:07:252015-01-01 00:00:00
Output for 7.0.6
2016-12-31 08:13:392017-01-01 00:00:00
Output for 7.0.5
2016-12-31 21:10:242017-01-01 00:00:00
Output for 7.0.4
2016-12-31 07:27:402017-01-01 00:00:00
Output for 7.0.3
2016-12-31 08:00:292017-01-31 00:00:00
Output for 7.0.2
2016-12-31 13:46:002017-01-31 00:00:00
Output for 7.0.1
2016-12-31 18:46:172017-01-31 00:00:00
Output for 7.0.0
2016-12-31 20:26:312017-01-31 00:00:00
Output for 5.6.21
2016-12-31 03:33:222017-01-01 00:00:00
Output for 5.6.20
2016-12-31 20:01:292017-01-01 00:00:00
Output for 5.6.19
2016-12-31 15:34:352017-01-01 00:00:00
Output for 5.6.18
2016-12-31 23:20:162017-01-31 00:00:00
Output for 5.6.17
2016-12-31 12:18:562017-01-31 00:00:00
Output for 5.6.16
2016-12-31 22:12:132017-01-31 00:00:00
Output for 5.6.15
2016-12-31 23:05:072017-01-31 00:00:00
Output for 5.6.14
2016-12-31 01:39:242017-01-31 00:00:00
Output for 5.6.13
2016-12-31 05:34:442017-01-31 00:00:00
Output for 5.6.12
2016-12-31 19:12:172017-01-31 00:00:00
Output for 5.6.11
2016-12-31 02:12:272017-01-31 00:00:00
Output for 5.6.10
2016-12-31 04:02:112017-01-31 00:00:00
Output for 5.6.9
2016-12-31 08:59:312017-01-31 00:00:00
Output for 5.6.8
2016-12-31 17:00:202017-01-31 00:00:00
Output for 5.6.7
2016-12-31 11:29:092017-01-31 00:00:00
Output for 5.5.35
2016-12-31 07:14:502017-01-31 00:00:00
Output for 5.5.34
2016-12-31 22:26:552017-01-31 00:00:00
Output for 5.5.33
2016-12-31 18:23:512017-01-31 00:00:00
Output for 5.5.32
2016-12-31 01:11:492017-01-31 00:00:00
Output for 5.5.31
2016-12-31 15:05:442017-01-31 00:00:00
Output for 5.5.30
2016-12-31 01:13:332017-01-31 00:00:00
Output for 5.5.29
2016-12-31 19:39:482017-01-31 00:00:00
Output for 5.5.28
2016-12-31 22:17:562017-01-31 00:00:00
Output for 5.5.27
2016-12-31 00:48:512017-01-31 00:00:00
Output for 5.5.26
2016-12-31 06:28:162017-01-31 00:00:00
Output for 5.5.25
2016-12-31 12:31:422017-01-31 00:00:00
Output for 5.5.24
2016-12-31 19:27:282017-01-31 00:00:00
Output for 5.4.45
2015-12-31 01:12:512016-01-31 00:00:00
Output for 5.4.44
2015-12-31 01:12:492016-01-31 00:00:00
Output for 5.4.43
2015-12-31 01:12:452016-01-31 00:00:00
Output for 5.4.42
2015-12-31 22:13:302016-01-31 00:00:00
Output for 5.4.41
2015-12-31 22:13:282016-01-31 00:00:00
Output for 5.4.39 - 5.4.40
2015-12-31 22:13:242016-01-31 00:00:00
Output for 5.4.38
2015-12-31 22:13:222016-01-31 00:00:00
Output for 5.4.36 - 5.4.37
2015-12-31 22:13:202016-01-31 00:00:00
Output for 5.4.35
2015-12-31 22:13:192016-01-31 00:00:00
Output for 5.4.13 - 5.4.34
2014-12-31 19:07:302015-01-31 00:00:00
Output for 5.3.21 - 5.4.12
2014-12-31 19:07:312015-01-31 00:00:00
Output for 5.3.6 - 5.3.20
2014-12-31 19:07:322015-01-31 00:00:00
Output for 5.3.0 - 5.3.5
2014-10-31 19:07:322014-11-30 00:00:00
Output for 5.2.17
Warning: DateTime::modify(): Failed to parse time string (last day of December) at position 9 (o): The timezone could not be found in the database in /in/6pvP7 on line 3 2014-10-29 19:07:322014-10-30 00:00:00
Output for 5.2.13 - 5.2.16
Warning: DateTime::modify(): Failed to parse time string (last day of December) at position 9 (o): The timezone could not be found in the database in /in/6pvP7 on line 3 2014-10-29 19:07:332014-10-30 00:00:00
Output for 5.2.0 - 5.2.12
2014-10-28 19:07:332014-10-29 00:00:00
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/6pvP7 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/6pvP7 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/6pvP7 on line 2