just pass the date time to this func. it would print out in time ago format for you
date_default_timezone_set('your-time-zone');
function convert($datetime){
$time=strtotime($datetime);
$diff=time()-$time;
$diff/=60;
$var1=floor($diff);
$var=$var1<=1 ? 'min' : 'mins';
if($diff>=60){
$diff/=60;
$var1=floor($diff);
$var=$var1<=1 ? 'hr' : 'hrs';
if($diff>=24){$diff/=24;$var1=floor($diff);$var=$var1<=1 ? 'day' : 'days';
if($diff>=30.4375){$diff/=30.4375;$var1=floor($diff);$var=$var1<=1 ? 'month' : 'months';
if($diff>=12){$diff/=12;$var1=floor($diff);$var=$var1<=1 ? 'year' : 'years';}}}}
echo $var1,' ',$var,' ago';
}