<?
foreach ($results as $data) {
$date = $data->created;
$now = new DateTime();
echo $date->diff($now)->format(" %y years,%d days, %h hours and %i minuts");
?>
I used this code to fetched date from mysql table and print it in codeigniter framework view file. And my mysql date type is "timestamp". So can you please help me to print the difference between today and the fetched date from mysql table. error msg-Call to a member function diff() on string -- and got this message after using this code