Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
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
Comment #2
Adam S CreditAttribution: Adam S commentedComment #3
ycshen CreditAttribution: ycshen commented$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());