Finding the number of days between two dates

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

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

30条回答
  •  清酒与你
    2020-11-22 00:17

    Easy to using date_diff

    $from=date_create(date('Y-m-d'));
    $to=date_create("2013-03-15");
    $diff=date_diff($to,$from);
    print_r($diff);
    echo $diff->format('%R%a days');
    
    • See more at: http://blog.innovsystems.com/php/get-number-days-between-two-dates-php

提交回复
热议问题