Answer the question
In order to leave comments, you need to log in
How to select today's entries in Yii2?
Hello, there is a table Bet , I'm trying to make a selection of records for today by the date field . It is of type timestamp , meaning it contains both the date and the time. It was possible to cut off the time thanks to the CAST function , but for some reason the request still does not display anything.
$bets = BetList::find()
->select('CAST(date AS DATE) AS date')
->where('order_id = :order_id', [':order_id' => $order->id])
->andWhere('date = :today', [':today' => date("Y-m-d")])
->one();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question