minuts bwtewwn two date laravel 1

minuts bwtewwn two date laravel

$to = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2015-5-6 3:30:34');
$from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2015-5-6 3:30:54');


$diff_in_minutes = $to->diffInMinutes($from);
print_r($diff_in_minutes); // Output: 20

Here is what the above code is Doing:
1. Create two Carbon instances, one for the current time and one for the time you want to compare to.
2. Use the diffInMinutes() method to get the difference in minutes between the two times.

Similar Posts