In yii2 how to organize the query interval of dates?

Need to do a sample for the period.
Do this, but not out
$leftDate = '2016-01-01'; 
$rightDate = date('Y-m-d');
$trips = Trip::find()
->joinWith(['idDrivers'])
 ->where('Date_start >= :left and Date_end <= :right', [':left' => $leftDate, ':right' => $rightDate])
 ->all();

The problem is probably that the dates in the database are stored in dateTime format, they have time. But I need only date.
July 9th 19 at 13:06
2 answers
July 9th 19 at 13:08
Solution
$leftDate = '2016-01-01'; 
$rightDate = date('Y-m-d');
$trips = Trip::find()
->joinWith(['idDrivers'])
 ->where('DATE(Date_start) >= :left and DATE(Date_end) <= :right', [':left' => $leftDate, ':right' => $rightDate])
 ->all();
July 9th 19 at 13:10
Thank you, but I can't
$trips = Trip::find()
->where('between', 'Date_start', $leftDate, $rightDate)
->joinWith(['idDrivers'])
->all(); //error indicates here
And another question, how do you do multiple conditions in where clause ?
1) use the and operator, where(['and', '['between', 'Date_start', $leftDate, $rightDate], ['between', 'Date_end', $leftDate, $rightDate]);
2) use the andWhere ->where('between', 'Date_start', $leftDate, $rightDate)->andWhere('between', 'Date_end', $leftDate, $rightDate); - watson_Torphy commented on July 9th 19 at 13:13

Find more questions by tags Yii