In Eloquent, you can use the date functions like: whereDay()
, whereMonth()
, whereYear()
, whereDate()
and whereTime()
.
User::whereDate('created_at', '2022-05-31')->get();
User::whereMonth('created_at', '5')->get();
User::whereDay('created_at', '31')->get();
User::whereYear('created_at', date('Y'))->get();
User::whereTime('created_at', '=', '12:12:12')->get();
Top comments (0)