function theme_date_time_ago in Date 6.2
Same name and namespace in other branches
- 8 date_api/theme/theme.inc \theme_date_time_ago()
- 7.3 date_api/theme/theme.inc \theme_date_time_ago()
- 7 date_api/theme/theme.inc \theme_date_time_ago()
- 7.2 date_api/theme/theme.inc \theme_date_time_ago()
1 theme call to theme_date_time_ago()
- theme_date_format_interval in date/date.theme
- Theme a format interval for a date element
File
- theme/theme.inc, line 393
- Theme functions for Date.
Code
function theme_date_time_ago($start_date, $end_date, $interval = 2) {
if (empty($start_date) || empty($end_date)) {
return NULL;
}
$now = date_format(date_now(), DATE_FORMAT_DATETIME);
$start = date_format($start_date, DATE_FORMAT_DATETIME);
$end = date_format($end_date, DATE_FORMAT_DATETIME);
if ($now < $start) {
return t('!time from now', array(
'!time' => date_format_interval($start_date, $interval),
));
}
elseif ($now > $start && $now <= $end) {
return t('ongoing');
}
else {
return date_format_interval($start_date, $interval);
}
}