whereDate / whereMonth / whereDay / whereYear / whereTime. The whereDate method may be used to compare a column's value against a date:
whereDate()
whereDate() through we can make condition like date even column datatype timestamps. you can see bellow example how it is work.
Example:
The whereDate method may be used to compare a column's value against a specifice date.you can see bellow example how it is work.
$products = DB::table('products')
->whereDate('created_at', '2021-09-03')
->get();
dd($products);
output
Illuminate\Support\Collection Object
(
[items:protected] => Array
(
[0] => stdClass Object
(
[id] => 2
[name] => Gold
[description] => Gold Brand
[created_at] => 2021-09-03 00:00:00
[updated_at] => 2021-09-01 00:00:00
)
[1] => stdClass Object
(
[id] => 4
[name] => Toll
[description] => Toll Brand
[created_at] => 2021-09-03 00:00:00
[updated_at] => 2021-09-05 00:00:00
)
)
)
Source : wheredate in laravel
It will help you...
Top comments (0)