A
A
alexeygavrilovs2020-04-14 14:18:33
PHP
alexeygavrilovs, 2020-04-14 14:18:33

Time check not working?

$forecasts = ForecastPage::get();
        $forecasts->each(function ($item) {
            $item->start_time = $item->bet()->value('start_date');
        });
        dump($forecasts);
        $forecastToday = $forecasts->where('start_time', date('Y-m-d'));

        dd($forecastToday);

I want to display only forecasts from today, but the data does not arrive, instead of date('Ymd') I put the value that is in the database, display everything, maybe there is a problem with the format? because in start_time there is a date with time, if it's in it how to change the format?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Gordinskiy, 2020-04-14
@DmitriyGordinskiy

Check if start_time is in the range from the first second of today to the last.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question