Tuesday, March 8, 2022

find days between two dates in laravel

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

$from = \Carbon\Carbon::createFromFormat('Y-m-d H:s:i', '2015-5-6 9:30:34'); $diff_in_days = $to->diffInDays($from); print_r($diff_in_days); // Output: 1

No comments:

Post a Comment