If you want to selecting a data with two date start date and end date in laravel so you can use given example below-
Example 1:

$start_date=carbon::parse($startDate)->format(“Y-m-d”);
$end_date=carbon::parse($endDate)->format(“Y-m-d”);

$query=User::query();
$query->whereDate(“created_at”,”>=”, $start_date);
$query->whereDate(“created_at”,”<=”, $start_date);
$query->get();

And If you want selecting a data with single date field in laravel you can use given example below-
Example 2:

$date=carbon::parse($date)->format(“Y-m-d”);
$query=User::query();
$query->whereDate(“created_at”,”=”, $date);
$query->get();

News Reporter
IT Software and web development, Core PHP, JavaScript, JQuery, HTML, CSS, CakePHP, Angularjs, Codeigniter etc.

1 thought on “Laravel: Select and Compare Data with Date

  1. *Spot on with this write-up, I truly think this website needs much more consideration. I?ll probably be again to read much more, thanks for that info.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code

error: