In entity.property.inc the entity_property_verify_data_type function only allows dates to have the form of an integer as a timestamp. The Date module, however, makes the conversion when necessary.

I'm trying to set a date field using the Entity Metadata Wrapper.

$wrapper->field_date->set(date('2016-01-14T00:30:00.000Z'));

    case 'date':
    case 'duration':
    case 'integer':
      return is_numeric($data) && strpos($data, '.') === FALSE;

Why does the date have to be numeric?

Comments

Adam S created an issue. See original summary.

Adam S’s picture

Issue summary: View changes
ycshen’s picture

$date_formate = array(
'timezone' => 'Asia/Shanghai',
'timezone_db' => 'Asia/Shanghai',
'date_type' => 'datetime',
);
$wrapper->field_xxxx_date->set($date_formate);
$wrapper->field_xxxx_date->value->set(timestamp());