You are here

function _exif_handle_date_field in Exif 7

handle date field.

Parameters

$exifindex:

$field_data:

Return value

unknown_type

1 call to _exif_handle_date_field()
_exif_handle_field in ./exif.module
handle field by delegating to specific type handler.

File

./exif.module, line 297

Code

function _exif_handle_date_field($index, $language, $field, $field_type, &$field_data, $exif_section, $exif_name, $exif_value) {
  $exif_value = _exif_handle_field_value_consistency($exif_value, $field);
  if ($exif_name == 'filedatetime') {
    $format = DateObject::ATOM;
  }
  else {

    //exif internal format do not handle timezone :(

    //Using website timezone instead.
    $format = variable_get('date_format_exif', 'Y-m-d\\TH:i:s');
  }
  $date_datetime = new DateObject($exif_value, NULL, $format);

  //change to requeted timezone
  $date_datetime
    ->setTimezone(timezone_open(date_get_timezone($field['settings']['tz_handling'])));
  $offset = $date_datetime
    ->getOffset();
  $date_field = $date_datetime
    ->format(date_type_format($field['type']));
  $field_data[$language][$index] = array(
    'value' => $date_field,
    'value2' => $date_field,
    'timezone' => $date_datetime
      ->getTimezone(),
    'offset' => $offset,
    'offset2' => $offset,
  );
}