Using Yii PHP framework, I produce the following query
SELECT * FROM `purchases` WHERE (date BETWEEN '2013-12-31' AND '2015-01-01')
with this code
$exportYear = "2014";
$criteria = new CDbCriteria();
$criteria->addBetweenCondition("date", ((int)$exportYear - 1) . "-12-31", ((int)$exportYear + 1) . "-01-01");
$purchases = Purchase::model()->findAll($criteria);
What I actually need is all 'purchases' that happened in year 2014. None from a minute before or after. What does the addBetweenCondition line need to be changed to in order to accomplish this?
where year(date) = 2014?