3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = DateTime::createFromFormat('d/m/Y','02/09/2013')->modify('midnight'); var_dump($date);
Output for 5.5.14 - 7.1.0
object(DateTime)#1 (3) { ["date"]=> string(26) "2013-09-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.5.0 - 5.5.13
object(DateTime)#1 (3) { ["date"]=> string(19) "2013-09-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" }
Output for 5.4.30 - 5.4.45
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /in/44QS1 on line 3 object(DateTime)#1 (3) { ["date"]=> string(26) "2013-09-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.4.0 - 5.4.29
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /in/44QS1 on line 3 object(DateTime)#1 (3) { ["date"]=> string(19) "2013-09-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" }
Output for 5.3.6 - 5.3.29
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /in/44QS1 on line 3 object(DateTime)#1 (3) { ["date"]=> string(19) "2013-09-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 5.3.4 - 5.3.5
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /in/44QS1 on line 3 object(DateTime)#1 (3) { ["date"]=> string(19) "2013-09-02 13:27:07" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 5.3.0 - 5.3.3
Warning: DateTime::createFromFormat(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /in/44QS1 on line 3 object(DateTime)#1 (3) { ["date"]=> string(19) "2013-09-02 13:27:08" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" }
Output for 5.2.10 - 5.2.17
Fatal error: Call to undefined method DateTime::createFromFormat() in /in/44QS1 on line 3
Process exited with code 255.
Output for 5.2.3 - 5.2.9
Fatal error: Call to undefined method DateTime::createfromformat() in /in/44QS1 on line 3
Process exited with code 255.
Output for 5.2.0 - 5.2.2
<br /> <b>Fatal error</b>: Call to undefined method DateTime::createfromformat() in <b>/in/44QS1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.1.6
<br /> <b>Fatal error</b>: Class 'DateTime' not found in <b>/in/44QS1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.4.2 - 4.4.9
<br /> <b>Parse error</b>: syntax error, unexpected T_OBJECT_OPERATOR in <b>/in/44QS1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
<br /> <b>Parse error</b>: parse error, unexpected T_OBJECT_OPERATOR in <b>/in/44QS1</b> on line <b>3</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/44QS1</b> on line <b>3</b><br />
Process exited with code 255.