You are here

function _signup_date_format_date in Signup 5.2

Same name in this branch
  1. 5.2 includes/date.5x-2.inc \_signup_date_format_date()
  2. 5.2 includes/date.5x-1.inc \_signup_date_format_date()
Same name and namespace in other branches
  1. 6.2 includes/date.inc \_signup_date_format_date()
  2. 6 includes/date.inc \_signup_date_format_date()
  3. 7 includes/date.inc \_signup_date_format_date()
1 call to _signup_date_format_date()
signup_format_date in includes/scheduler.inc

File

includes/date.5x-1.inc, line 89
Code required to support version 5.x-1.* of the CCK date field module.

Code

function _signup_date_format_date($node) {
  $field = signup_date_field($node->type);
  if (!$field || $field == 'none') {
    return '';
  }
  if (isset($node->{$field['field_name']})) {
    $date_value = $node->{$field['field_name']}[0]['value'];
  }
  elseif (isset($node->{$field['field_name'] . '_value'})) {
    $date_value = $node->{$field['field_name'] . '_value'};
  }
  else {
    $date_value = $node->{$field['database']['columns']['value']['column']};
  }
  $date_obj = date_make_date($date_value, 'GMT', 'db', $field['type']);
  switch ($field['tz_handling']) {
    case 'site':
      $timezone_name = date_get_site_timezone();
      break;
    case 'date':
      $timezone_name = $field['field_timezone'];
      break;
  }
  if (!empty($timezone_name)) {
    $offset = date_offset(date_gmgetdate($date_obj->db->timestamp), $timezone_name);
  }
  else {
    $offset = 0;
    $timezone_name = NULL;
  }
  return date_format_date($field['output_format_date'], date_fuzzy_stamp($date_obj->db) + $offset, 0, $timezone_name);
}