T
T
Tokenchik2017-05-12 15:19:20
Yii
Tokenchik, 2017-05-12 15:19:20

How to select current date using ActiveRecord in Yii2?

The database has a time field of type timestamp, with values ​​- 2017-05-01 16:21:01
How to write a request to get records with time = current date using ActiveRecord in Yii2?
I know how to do it simply in sql, but surely this can be done in ActiveRecord too?
Throw slippers and poke your nose into mana, I will be grateful to have show me where to look)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-05-12
@Tokenchik

MyActiveRecord::find()->where(['time' => time()])->all()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question