31556926,'month'=>2629744,'week'=>604800,'day'=>86400,'hour'=>3600,'minute'=>60,'second'=>1); // Calculate how long ago the timestamp is $diff = time() - $timestamp; foreach($t as $unit=>$seconds){ if($seconds<=$diff){ $v=floor($diff/$seconds); $nice_diff="$v $unit".($v==1?'':'s').' ago'; break; } } echo $nice_diff; ?>