3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $Draw_time = "29/01/2016 7pm"; $date = DateTime::createFromFormat("d/m/Y ha",$Draw_time); $new_date = $date->format('Y-m-d H:i:s'); $date2 = new DateTime(); echo $diff = $date2->diff($new_date)->format("%a");
based on 5HEAS
Output for 7.0.0 - 7.2.0
Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, string given in /in/V4nnt on line 9 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/V4nnt:9 Stack trace: #0 {main} thrown in /in/V4nnt on line 9
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, string given in /in/V4nnt on line 9 Fatal error: Call to a member function format() on boolean in /in/V4nnt on line 9
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Warning: DateTime::diff() expects parameter 1 to be DateTimeInterface, string given in /in/V4nnt on line 9 Fatal error: Call to a member function format() on a non-object in /in/V4nnt on line 9
Process exited with code 255.
Output for 5.3.22 - 5.4.45
Warning: DateTime::diff() expects parameter 1 to be DateTime, string given in /in/V4nnt on line 9 Fatal error: Call to a member function format() on a non-object in /in/V4nnt on line 9
Process exited with code 255.