ramniksingh
1 week ago
549
32
Eloquent

filter records via query where date is greater than some date

Posted 1 week ago by ramniksingh

Hi, I have been trying this and searching for solution:

$qry = DB::table('appcal')
                    ->select('monthyear','appdate')
                    ->whereDate('appdate','>=', '2018-04-01')
                    ->get(); 

It does not work & gives me no records at all ( even the query shows nothing without even giving any error).

But when I use the below it gives me correct records

$qry = DB::table('appcal')
                    ->select('monthyear','appdate')
                    ->whereDate('appdate','=', '2018-04-01')
                    ->get(); 

Why is that behaviour? The actual problem was with a date record from database, but I converted it to static date 2018-04-01 to test the logic.

Please sign in or create an account to participate in this conversation.