📌  相关文章
📜  laravel 8 以天为单位的日期差异 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:53:58.490000             🧑  作者: Mango

代码示例1
$last_date = "2018-01-10 00:00:00";
        $current_date = Carbon::now()->toDateTimeString();

          //NUMBER DAYS BETWEEN TWO DATES CALCULATOR
          $start_date = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $last_date);
          $end_date = \Carbon\Carbon::createFromFormat('Y-m-d H:i:s', $current_date);
          $different_days = $start_date->diffInDays($end_date);