vendredi 28 juillet 2017

Query not working searching between dates

my query is not working, basically im trying to get records between dates_time but for some reason is not working, i already checked on my db and should return one result. Im using Carbon and Eloquent from Laravel.

$todayFictitiasDate = new Carbon("2017-08-09 16:00:00");

//records between 2017-08-09 17:00:00 and 2017-08-09 21:00:00

$liveMatches = SoccerMatch::where('date_time','>=', $todayFictitiasDate->addHour())
                        ->where('date_time','<=',$todayFictitiasDate->addHours(5))
                        ->get();

My record on db:

id= 1
title =  something
date_time = 2017-08-09 18:00:00



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

Aucun commentaire:

Enregistrer un commentaire