In question's meta, which asked in several minutes ago.
function qa_time_to_string($seconds)
/*
Return textual representation of $seconds
*/
{
if (qa_to_override(__FUNCTION__)) { $args=func_get_args(); return qa_call_override(__FUNCTION__, $args); }
$seconds=max($seconds, 1);
$scales=array(
31557600 => array( 'main/1_year' , 'main/x_years' ),
2629800 => array( 'main/1_month' , 'main/x_months' ),
604800 => array( 'main/1_week' , 'main/x_weeks' ),
86400 => array( 'main/1_day' , 'main/x_days' ),
3600 => array( 'main/1_hour' , 'main/x_hours' ),
60 => array( 'main/1_minute' , 'main/x_minutes' ),
1 => array( 'main/1_second' , 'main/x_seconds' ),
);
foreach ($scales as $scale => $phrases)
if ($seconds>=$scale) {
$count=floor($seconds/$scale);
if ($count==1)
$string=qa_lang($phrases[0]);
else
$string=qa_lang_sub($phrases[1], $count);
break;
}
return $string;
}