PHP : Hace Script / Ago Script
if we call with a timestamp of a month ago, he print "Hace 1 mes". If you want this in english should traduction. Sorry my english
function hace($timestamp) { $diferencia = time() - $timestamp; if($diferencia > 0) { $periodo = array("segundo", "minuto", "hora", "dia", "semana", "mes" , "año", "decada"); $longitud = array( "60" , "60" , "24" , "7" , "4.35", "12" , "10" ); for($j = 0; $diferencia >= $longitud[$j]; $j++) $diferencia /= $longitud[$j]; $diferencia = round($diferencia); if($diferencia != 1) { if($periodo[$j] == "mes") $periodo[$j].= "es"; else $periodo[$j].= "s"; } return "Hace <b>".$diferencia."</b> ".$periodo[$j]; } }