Finding the number of days between two dates

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

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

30条回答
  •  一个人的身影
    2020-11-22 00:05

    You can find dates simply by

    y . ' years, ';
    echo  $diff->m . ' months, ';
    echo  $diff->d . ' days, ';
    echo  $diff->h . ' hours, ';
    echo  $diff->i . ' minutes, ';
    echo  $diff->s . ' seconds';
    // Output: The difference is 28 years, 5 months, 19 days, 20 hours, 34 minutes, 36 seconds
    
    echo 'The difference in days : ' . $diff->days;
    // Output: The difference in days : 10398
    

提交回复
热议问题