php - Yii2 query with DateTime data returns more data than expected
Get the solution ↓↓↓I want to know the amount of instances that have been published in the last 10 days.
This is what I wrote:
$date = new DateTime('now');
$meno_dieci_giorni = $date->sub(new DateInterval('P10D'));
$ultime_iniziative = Iniziativa::find()
->where(['>=' , 'ym_published_date' , $meno_dieci_giorni])
->count();
and this is what I do when I try to retrieve:
if ($ultime_iniziative > 0) {
#do something
}
but It returns more data than expected. Can someone help me?
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: call to undefined function illuminate\encryption\openssl_cipher_iv_length()
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.