public function time_ago($from, $to = null, $format_past = '%s ago', $format_future = '%s from now')
{
$to = $to === null ? time() : $to;
$to = is_int($to) ? $to : strtotime($to);
$from = is_int($from) ? $from : strtotime($from);
if ($from < $to) {
return sprintf($format_past, human_time_diff($from, $to));
} else {
return sprintf($format_future, human_time_diff($to, $from));
}
}