A
A
Alexander2018-02-09 19:37:23
Laravel
Alexander, 2018-02-09 19:37:23

Recordings for a specific day?

The entry in the database (MySQL) has a visit_date field, datetime format.
How to pull records for today?
Tried something like this Visitlist::where('visit_date', '=', Carbon::today())->get();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2018-02-09
@Alex1237

Here is a design that helped solve the problem

Visitlist::whereDate('created_at', '=', Carbon::today()->format('Y-m-d'))->get();

K
Konstantin B., 2018-02-09
@Kostik_1993

$q->whereDay('created_at', '=', date('d'));
$q->whereMonth('created_at', '=', date('m'));
$q->whereYear('created_at', '=', date('Y'));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question