Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stargatesg1's avatar

Selecting date field

I am having problems selecting a date field. Lets say created_at has the value of

"created_at": "2017-04-01 14:27:36" I want to write a Eloquent statement like this

        $getCurrent=$Usage->where([
            ['track_id', '=', 16],
            ['user_id', '=', 1],
            ['created_at', '=', date('Y-m-d')]
        ])->get();

So in the created_at it will select the current date minus the time.

0 likes
2 replies
Mittensoff's avatar

You can also compare between yesterday and tomorrow, but it's not that pretty.

Please or to participate in this conversation.