title: Yii CActiveDataProvider filter by date range criteria
body: <p>I'm working with Yii 1.1.8. Trying to limit the $dataProvider source by date in a controller action. I want to filter the dataset to show only the recent 2 year entries, but couldn't get it to work.</p>
  
  <p>I got two records in the Event table where one is dated 2 months ago and the other is dated 4 years ago.</p>
  
  <p>Tried:</p>
  
  <pre><code>$dataProvider=new CActiveDataProvider('Event', array(
                      'criteria'=&gt;array(
                          'condition'=&gt;'date &gt;= '.date('Y-m-d', strtotime('-2 years')). ' AND  date &lt;='. date('Y-m-d'),
                      ),
                  ));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$dataProvider=new CActiveDataProvider('Event', array(
                      'criteria'=&gt;array(
                          'condition'=&gt;'date &gt;= '.date('Y-m-d', strtotime('-2 years')),
                      ),
                  ));
  </code></pre>
  
  <p>and </p>
  
  <pre><code>$dataProvider=new CActiveDataProvider('Event', array(
                      'criteria'=&gt;array(
                          'condition'=&gt;'date BETWEEN '.date('Y-m-d', strtotime('-2 years')).' AND '. date('Y-m-d'),
                      ),
                  ));
  </code></pre>
  
  <p>All returned with "No results found". What am I doing wrong? It seems it should be something simple, but I'm stumped.</p>