Hey, guys!!
I have to filter CGridView using a date field. The problem is that i have to inform the date in i18n format, like d/m/Y, so i’ve made some changes in the model search function to transform the parameter into a database format:
model/search
if($this->offerDateStart <> ''):
$datetransf = date('Y-m-d', CDateTimeParser::parse($this->offerDateStart, Yii::app()->locale->dateFormat));
$criteria->compare('offerDateStart', $datetransf ,false, '>=');
else:
$datetransf = null;
endif;
Neither $criteria->compare nor $criteria->addSearchCondition gives me the corresponding ">=" SQL operator, I only get the following SQL:
....WHERE (offerDateStart=:ycp0). Bind with parameter :ycp0='2010-08-03'
One could say that I shoud use the operators in the grid, but if I try to convert the string “>=22/03/2010” into a valid sql date, I’ll get 1969-12-31 (null value)
…unless somebody tells me that there is a way to get the pure value entered in the grid, without the operator
Any help will be very appreciated!!
thanks
regards!!