To get records between two dates using addAttributeToFilter, use code like this:
$collection->addAttributeToFilter('start_date', array('date' => true, 'to' => $todaysDate))
->addAttributeToFilter('end_date', array(array(
array('date' => true, 'from' => $todaysDate),
array('null' => true)
), 'left');
Note: Where $collection is collection from your model.
Note: $todaysDate can be replaced by date of your choice.
That's all.. cheers.. :)
No comments:
Post a Comment