Answer the question
In order to leave comments, you need to log in
How to select records for today, yesterday and so on in yii2?
how to write a condition in the filter so that records are selected for today, yesterday, etc. field in unix database
$tomorrow = strtotime('+1 days');
..
->where(['>=', 'created_at', mktime(0,0,0,date('m'),date('d'),date('Y'))])
->andWhere(['<', 'created_at', mktime(0,0,0,date('m', $tomorrow),date('d', $tomorrow),date('Y', $tomorrow))])
Answer the question
In order to leave comments, you need to log in
The request itself will be something like this:
SELECT FROM_UNIXTIME(t.created_at), t.*
from table_name t
where (FROM_UNIXTIME(t.created_at) + interval 1 day) >= now()
$lines = $this->find()
->alias('t')
->where("(FROM_UNIXTIME(t.created_at) + interval :days day) >= now()", [
':days' => $day
])
->all();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question