Support the ongoing development of Laravel.io →
posted 10 years ago
Database
Last updated 2 years ago.
0
where( DB::raw( 'DATE(created_at)' ), Carbon\Carbon::now()->toDateString())

or with db function like:

whereRaw( 'DATE(created_at) = CURRENT_DATE')

EDIT: Carbon has one more handy function for you: today(), so the first code might look like:

where( DB::raw( 'DATE(created_at)' ), Carbon\Carbon::today() )
Last updated 2 years ago.
0

@jarektkaczyk,

It works thank you.

Last updated 2 years ago.
0

I have one more dought, How to get the time of stored column, Means i want to delete the entry which has stored one hour back. Thank you for help

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Sikandhar sikandhar Joined 18 Jun 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.