Answer the question
In order to leave comments, you need to log in
How to filter by date in a query?
Please advise:
There is a node type with multiple date field (one node can have multiple dates).
You need to select records by date range, but it works somehow strangely.
For example:
$query->entityCondition('entity_type', 'node')
->entityCondition('bundle', 'performance') // ex. article
->propertyCondition('status', NODE_PUBLISHED)
->fieldCondition('field_date_perf', 'value', "2015-12-25", '>=')
->fieldCondition('field_date_perf', 'value', "2015-12-31", '<=')
->fieldOrderBy('field_date_perf', 'value', 'ASC');; // published nodes
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question