Finding the number of days between two dates

后端 未结 30 3059
心在旅途
心在旅途 2020-11-21 23:47

How to find number of days between two dates using PHP?

30条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-22 00:22

    I'm using Carbon in my composer projects for this and similar purposes.

    It'd be as easy as this:

    $dt = Carbon::parse('2010-01-01');
    echo $dt->diffInDays(Carbon::now());
    

提交回复
热议问题