You are here

function theme_tzfield_formatter_date in Time Zone Field 6

Theme function for date format timezone field formatters.

1 string reference to 'theme_tzfield_formatter_date'
tzfield_theme in ./tzfield.module
Implementation of hook_theme().

File

./tzfield.module, line 410
Defines a field type for storing timezones.

Code

function theme_tzfield_formatter_date($element) {
  switch ($element['#formatter']) {
    case 'abbreviation':
      $format = 'T';
      break;
    case 'medium':
      $type = 'medium';
      break;
    case 'rfc2822':
      $format = 'r';
      break;
  }
  $format = isset($format) ? $format : variable_get('date_format_' . $type, 'D, m/d/Y - H:i');
  return $element['#item']['timezone'] ? date_format(date_create('now', timezone_open($element['#item']['timezone'])), $format) : NULL;
}