Answers for "how to get records between two dates in laravel"

PHP
1

how to calculate date difference between two dates in laravel

//How to calculate date different between two dates in larevel
// METHOD-1
$date1 = new DateTime("2018-01-10 00:00:00");
$date2 = new DateTime("2019-05-18 01:23:45");
$difference = $date1->diff($date2);
$diffInSeconds = $difference->s; //45
$diffInMinutes = $difference->i; //23
$diffInHours   = $difference->h; //8
$diffInDays    = $difference->d; //21
$diffInMonths  = $difference->m;
Posted by: Guest on March-04-2021

Code answers related to "how to get records between two dates in laravel"

Browse Popular Code Answers by Language