3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateFormat3 = 'Y-m-d H:i:s'; $date1=date_create("2015-09-29 6:30:45AM"); $date2=date_create(date($dateFormat3)); $diff=date_diff($date1,$date2); echo $date2 . "\n" . $diff->format("%m months, %d days, %H:%I:%S");
based on MflsJ
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class DateTime could not be converted to string in /in/4ovif on line 7
Process exited with code 255.
Output for 5.4.0 - 7.0.20
Catchable fatal error: Object of class DateTime could not be converted to string in /in/4ovif on line 7
Process exited with code 255.