i have a date field in my database which has datetype as data type, how can i use active record to fetch data according to specific date range?
$model = ModelName::find()
->where(["date"=>"FROM '2015-06-21' TO '2015-06-27' ", "status"=>1])->all();
I think the correct way could be this:
$model = ModelName::find()->where(['between', 'date', "2015-06-21", "2015-06-27" ])
->andWhere(['status'=> 1])->all();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With