You are here

function theme_date_views_browser_period_label in Date 6

Same name and namespace in other branches
  1. 5.2 date/date.theme \theme_date_views_browser_period_label()
  2. 5 date_views.inc \theme_date_views_browser_period_label()

Theme for the current period label name

File

date/date.theme, line 126
Theme functions.

Code

function theme_date_views_browser_period_label($period, $date) {
  switch ($period) {
    case 'year':
      $format = 'Y';
      break;
    case 'month':
      $format = 'F Y';
      break;
    case 'day':

      // Use just the year/month/day part of the short date format.
      $format = date_limit_format(variable_get('date_format_short', 'm/d/Y - H:i'), array(
        'month',
        'day',
        'year',
      ));
      break;
    case 'hour':

      // Use just the year/month/day/hour part of the short date format.
      $format = date_limit_format(variable_get('date_format_short', 'm/d/Y - H:i'), array(
        'month',
        'day',
        'year',
        'hour',
      ));
  }
  return t('%period of %date', array(
    '%period' => ucwords($period),
    '%date' => date_format_date($date, 'custom', $format),
  ));
}