mercredi 2 septembre 2015

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();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1VxPVWR
via IFTTT

Aucun commentaire:

Enregistrer un commentaire