You are here

function views_handler_field_profile_date in Views (for Drupal 7) 5

Display a profile field of type 'date'

1 string reference to 'views_handler_field_profile_date'
profile_views_add_field in modules/views_profile.inc
Add profile fields to view table

File

modules/views_profile.inc, line 265

Code

function views_handler_field_profile_date($fieldinfo, $fielddata, $value, $data) {
  $format = substr(variable_get('date_format_short', 'm/d/Y - H:i'), 0, 5);

  // Note: Avoid PHP's date() because it does not handle dates before
  // 1970 on Windows. This would make the date field useless for e.g.
  // birthdays.
  $value = unserialize($value);
  $replace = array(
    'd' => sprintf('%02d', $value['day']),
    'j' => $value['day'],
    'm' => sprintf('%02d', $value['month']),
    'M' => map_month($value['month']),
    'Y' => $value['year'],
    'H:i' => null,
    'g:ia' => null,
  );
  return strtr($format, $replace);
}