Answer the question
In order to leave comments, you need to log in
How to output data in yii2 mysql date span?
$dataProvider = new ActiveDataProvider([
'query' => \app\models\Zakaz::find(
->where('action <= 0') ->andWhere( 'date >= 2018-04-01 AND date <= 2018-08-01')
/* ->groupBy('date_close')*/,
'pagination' => [
'pageSize' => 20,
],
]);
Answer the question
In order to leave comments, you need to log in
Good evening.
You store the date along with the time.
So why not try this:
Although it's better to store the time in a timestamp, the field type in the table is integer.
UPD.
<code lang="php">
andWhere(['>=', 'date', strtotime('2018-04-01 00:00:00')])->andWhere(['<=', 'date', strtotime('2018-08-01 23:59:59')]);
</code>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question