Skip to content
Advertisement

PHP Carbon / Laravel Eloquent – Check if DateTime value is for the current day

I am working on a booking system and need to select only the records where a certain field is for today. Not today and in the future, but only today.

The query currently is:

The requested_booking_time is the field that I wish to be checked, the date stored is in this format:

So I want to only select rows that are on the same day as the current day.

Advertisement

Answer

As i understand, you want that records which is created today; then just get the today’s date.

now your query is like this.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement