I want to compare if difference between current date and date from database is hours or days. I tried the following but there is notice:
Call to a member function format() on a non-object
My code is:
 $date =  new DateTime('now');
 $current =$date->format('Y-m-d h:i:s');
 $newDate = DateTime::createFromFormat("l dS F Y", $final['created_at']);
 $newDate = $newDate->format('Y-m-d h:i:s'); 
         Whick is the correctway to do this compare?I want if difference is hours, to show howrs, if difference is days, to show only count days without hours.
Thanks in advance!
