You are here

function date_entity_metadata_struct_getter in Date 7

Same name and namespace in other branches
  1. 7.3 date.module \date_entity_metadata_struct_getter()
  2. 7.2 date.module \date_entity_metadata_struct_getter()

Getter callback to return date values as datestamp in UTC.

2 calls to date_entity_metadata_struct_getter()
date_entity_metadata_duration_getter in ./date.module
Getter callback to return the duration of the time period given by the dates.
date_entity_metadata_field_getter in ./date.module
Getter callback to return date values as datestamp in UTC from the field.
1 string reference to 'date_entity_metadata_struct_getter'
date_entity_metadata_property_info_alter in ./date.module
Callback to alter the property info of date fields.

File

./date.module, line 611

Code

function date_entity_metadata_struct_getter($item, array $options, $name, $type) {
  $value = trim($item[$name]);
  $timezone_db = !empty($item['timezone_db']) ? $item['timezone_db'] : 'UTC';
  $date = new DateObject($value, $timezone_db);
  return !empty($date) ? date_format_date($date, 'custom', 'U') : NULL;
}