i using default search provided yii cgridview. have text date field in search criteria. trying compare date passed date in database not matching. need convert format of dates stored in database date in database have time , need remove time before comparing dates, cannot figure out way this.
in default search function() line want convert dates before comparing. have tried conversion not seem work.
$criteria->compare(date("y-m-d", strtotime('application_date')), date("y-m-d", strtotime($this->application_date)),true); thanks help!!!
there 1 way of doing this, have use date_format function of mysql follow:
$criteria->compare('date_format(application_date,"%y-%m-%d")',date("y-m-d", strtotime($this->application_date)),true);
Comments
Post a Comment