Laravel ORM, date compare

后端 未结 6 1392
情歌与酒
情歌与酒 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:10

    date('Y-m-d H:i:s') returns date of now.

    If you want results from start of the day you can replace it with date('Y-m-d').' 00:00:00'.

    If you want results from last 24 hours you can replace it with date('Y-m-d H:i:s',time()-86400) (86400 = 24*60*60)

提交回复
热议问题