With the below code I select some entities no older than today.
$query = new EntityFieldQuery(); $query ->entityCondition('entity_type', 'whats_on') ->entityCondition('bundle', 'events') ->fieldCondition('field_event_date_time', 'value', date("Y-m-d"), '>') // Show events no earlier than today ->fieldOrderBy('field_event_date_time', 'value', 'ASC')
Is it possible to show events only for this week, meaning, I'll need to somehow track what day it is and display only the events for the days remaining till Sunday.
If today is Friday, we only show events for Friday, Saturday and Sunday (only 3 days left in this week).
Is this something we can do with fieldCondition, maybe a small snippet of PHP we can add above as shown below, which I did try but only shows events after 7 days?
->fieldCondition('field_event_date_time', 'value', date("Y-m-d",strtotime("+1 week")), '>')