3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $calcul = (strtotime("today") - strtotime("12-09-2013")); echo strftime("%d-%m-%Y", $calcul) . '<br />'; $now = new DateTime('NOW'); echo strftime("%d-%m-%Y", strtotime("today")); $date1 = new DateTime("03-24-2007"); $date2 = new DateTime("03-26-2009"); $interval = $date1->diff($date2); echo "difference " . $interval->y . " years, " . $interval->m." months, ".$interval->d." days ";
Output for 7.0.0 - 7.1.0
09-09-1972<br />21-05-2016 Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (03-24-2007) at position 0 (0): Unexpected character in /in/JdoLv:8 Stack trace: #0 /in/JdoLv(8): DateTime->__construct('03-24-2007') #1 {main} thrown in /in/JdoLv on line 8
Process exited with code 255.
Output for 5.2.0 - 5.6.28
09-09-1972<br />21-05-2016 Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (03-24-2007) at position 0 (0): Unexpected character' in /in/JdoLv:8 Stack trace: #0 /in/JdoLv(8): DateTime->__construct('03-24-2007') #1 {main} thrown in /in/JdoLv on line 8
Process exited with code 255.
Output for 5.1.3 - 5.1.6
09-09-1972<br /> Fatal error: Class 'DateTime' not found in /in/JdoLv on line 5
Process exited with code 255.
Output for 5.1.0 - 5.1.2
21-05-2016<br /> Fatal error: Class 'DateTime' not found in /in/JdoLv on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5
18-03-1968<br /> Fatal error: Class 'DateTime' not found in /in/JdoLv on line 5
Process exited with code 255.
Output for 4.3.6 - 4.4.9
18-03-1968<br /> Fatal error: Cannot instantiate non-existent class: datetime in /in/JdoLv on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.5
<br /> Fatal error: Cannot instantiate non-existent class: datetime in /in/JdoLv on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> Fatal error: Cannot instantiate non-existent class: datetime in /in/JdoLv on line 5