Laravel ORM, date compare

后端 未结 6 1591
情歌与酒
情歌与酒 2021-02-03 23:41

I\'m using Laravel Framework.

I want all of the rows for this day. This is what I tried:

DB::table(\'users\')->where(\'created_at\', \'>=\', date(         


        
6条回答
  •  我寻月下人不归
    2021-02-04 00:01

    Use whereDate

    $users = DB::table('users')
                    ->whereDate('created_at', '2016-12-31')
                    ->get();
    

    other functions you may use are: whereDate / whereMonth / whereDay / whereYear / whereTime

提交回复
热议问题