title: Filter Date using Date Picker in Yii
body: <p>I have generated my crud screens using gii.. I have a search form, where i have put a date picker, where i give the user to select the date he wants.</p>
  
  <p>But the problem is that i have the date stored in seconds in the database.</p>
  
  <p>and i know that i can convert the date using strtotime. But then how do i filter using the search method in my model?</p>
  
  <p>this is my date picker </p>
  
  <pre><code>&lt;?php 
          $this-&gt;widget('zii.widgets.jui.CJuiDatePicker', array(
  
          'name'=&gt;'ordering_date',
          'id'=&gt;'ordering_date',
          // additional javascript options for the date picker plugin
          'options'=&gt;array(
              'showAnim'=&gt;'fold',
          ),
          'htmlOptions'=&gt;array(
              'style'=&gt;'height:20px;'
          ),
          ));
      ?&gt;
  </code></pre>
  
  <p>and this is my search method in my model. I want to compare the ordering_date </p>
  
  <pre><code>public function search()
  {
      // Warning: Please modify the following code to remove attributes that
      // should not be searched.
      //echo $this-&gt;ordering_date;
      $criteria=new CDbCriteria;
  
      $criteria-&gt;compare('order_id',$this-&gt;order_id);
      $criteria-&gt;compare('customer_id',$this-&gt;customer_id);
      $criteria-&gt;compare('delivery_address_id',$this-&gt;delivery_address_id);
      $criteria-&gt;compare('billing_address_id',$this-&gt;billing_address_id);
      $criteria-&gt;compare('ordering_date',$this-&gt;ordering_date);
      $criteria-&gt;compare('ordering_done',$this-&gt;ordering_done,true);
      $criteria-&gt;compare('ordering_confirmed',$this-&gt;ordering_confirmed);
      $criteria-&gt;compare('payment_method',$this-&gt;payment_method);
      $criteria-&gt;compare('shipping_method',$this-&gt;shipping_method);
      $criteria-&gt;compare('comment',$this-&gt;comment,true);
      $criteria-&gt;compare('status',$this-&gt;status,true);
      $criteria-&gt;compare('total_price',$this-&gt;total_price);
  
      return new CActiveDataProvider($this, array(
          'criteria'=&gt;$criteria,
      ));
  }
  </code></pre>