I am running the following code, retrieving a list of job openings that will expire in 7 days.
$triggerDate = new DateTime();
$triggerDate->add(new DateInterval("P7D"));
$query = new EntityFieldQuery();
$query->entityCondition('entity_type','node')
->entityCondition('bundle','job')
->propertyCondition('status',1)
->fieldCondition('field_expires','value',$triggerDate->format('Y-m-d'),'=');
This is returning 0 jobs, even though I have several that will expire in 7 days. For example, one of my job nodes, has the following value
[field_expires] => Array
(
[und] => Array
(
[0] => Array
(
[value] => 2013-05-09T00:00:00
[timezone] => America/Los_Angeles
[timezone_db] => America/Los_Angeles
[date_type] => date
)
)
)
When I leave the filter off altogether, the query succeeds and retrieves all items. I've tried many variations of the date format including Y-m-d\T00:00:00
and Y-m-d 00:00:00
.
The field is of type: Date (ISO format)
. What am I doing wrong?
field_expires
?