From date and to Date Query in Yii?

Hi,

My site Merchant add offer Validation from_date and to_date,

For example, Today MAy 5th, If am going to add offer which is from date on May 6th to To as May 10th… ( offer title - Ice cream 50%)

So I want to Show offer list May 6 th to May 10 th, So today 5th, User can’t show that offer,May 6th onwards Offers in List page and May 11th offer will be expire so May 11 it offer not show in that List

How to write Query in yii,

$date = date('Y-m-d');


$criteria2 = new CDbCriteria();


$criteria2->with = array('merchant');


$criteria2->condition = "t.to_date >= :t_dat and t.from_date >= :t_dat";


$params[':t_dat'] = $date;


$criteria2->params = $params;


$results3 = Offers::model()->findAll($criteria2);

My above coding it will not show any offer , after that May 7 .

check your condition as above it say "to_date >= ‘May 5th’ and from_date >= ‘May 5th’

Thanq SO much