Yii Date Tutorials

DATE_FORMAT Search In Yii Framework 1.0

This tutorial will help you to find the result using DATE_FORMAT() function. ‘DATE_FORMAT’ function is used to convert the integer to date format value. I add the source code for this type of date search. In addCondition i used DATE_FORMAT function to filter the result. <?php public function search() { $criteria=new CDbCriteria; // condition for >= single date if(!empty($this->from_date) && empty($this->to_date)) { $this->from_date=date('Y-m-d',strtotime($this->from_date)); $criteria->addCondition( "DATE_FORMAT(checkin_time, '%Y-%m-%d') >= '$this->from_date'" ); } […]... Read More »