You are here

function entity_property_verbatim_date_get in Entity API 7

Date values are converted from ISO strings to timestamp if needed.

File

includes/entity.property.inc, line 405
Provides API functions around hook_entity_property_info(). Also see entity.info.inc, which cares for providing entity property info for all core entity types.

Code

function entity_property_verbatim_date_get($data, array $options, $name, $type, $info) {
  $name = isset($info['schema field']) ? $info['schema field'] : $name;
  if (is_array($data) || is_object($data) && $data instanceof ArrayAccess) {
    return is_numeric($data[$name]) ? $data[$name] : strtotime($data[$name], REQUEST_TIME);
  }
  elseif (is_object($data)) {
    return is_numeric($data->{$name}) ? $data->{$name} : strtotime($data->{$name}, REQUEST_TIME);
  }
}