N
N
NubasLol2018-09-06 17:47:47
Laravel
NubasLol, 2018-09-06 17:47:47

Laravel how to compare date correctly?

$q->where('created_at', '>=', $dateFrom)
$dateFrom has the format 'Ymd' . Hours are stored in the database, so the condition for equality does not work, only if it is less than a day

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-09-06
@NubasLol

Good evening.
Approximately like this:

$q->where('created_at', '>=', $dateFrom . ' 00:00:00');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question