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

feniixx's avatar

Date value of datetime column using FLUENT in laravel 5.0

How could i get only de date of a datetime column in laravel 5 using fluent?

I want to compare this 2015-08-30 23:00:00 with this:

        $dt = Carbon::now();
        $d = $dt->toDateString();//this is the date only which i want to compare

There is a mysql function called DATE which extract the date part of a date or datetime expression like this DATE(`datetime`) but if i use it it gives me a integrity error.

Here's how i tried to use it:

    $reservations = \DB::table('reservations')
                ->select('reservations.id','DATE(reservations.datetime)')
                ->get();
0 likes
0 replies

Please or to participate in this conversation.