Select any entity created today One of an entity properties is a timestamp, set when it was created.

I want to use the EntityFieldQuery class to load entities that were created today.

Normally, I would write a query using DATE_FORMAT(FROM_UNIXTIME(created_timestamp), "%Y-%m-%d") = "2014-03-17".

I'm not aware of any method to use any MySQL functions in EntityFieldQuery. I have tried with the following code.

$day_start = strtotime(date('Y-m-d 00:00:00', $created_ts));
$day_end = strtotime(date('Y-m-d 23:59:59', $created_ts));
$query-&gt;propertyCondition('created', $day_start, '&gt;')
  -&gt;propertyCondition('created', $day_end, '&lt;');


Whilst this works, it doesn't seem as efficient and certainly less succinct. Is there a function that I can use with EntityFieldQuery similar to SelectQuery::where() that would allow to write code similar to the following one?

$query-&gt;propertyWhere('DATE_FORMAT(FROM_UNIXTIME(created), "%Y-%m-%d")', "2014-03-17");
You can use below code , PropertyCondition accepts range values using BETWEEN operator.. Since timestamp is stored as int in database node table created column with data and time together below code works to fetch records of a particular date..

&lt;?php
$day_start = strtotime(date('Y-m-d 00:00:00', $created_ts));
$day_end = strtotime(date('Y-m-d 23:59:59', $created_ts));
$query
    -&gt;propertyCondition('created', array($day_start, $day_end), 'BETWEEN');
?&gt;


Find more about propertyCondition in D.O