Finding the number of days between two dates

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

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

30条回答
  •  自闭症患者
    2020-11-22 00:07

        // Change this to the day in the future
    $day = 15;
    
    // Change this to the month in the future
    $month = 11;
    
    // Change this to the year in the future
    $year = 2012;
    
    // $days is the number of days between now and the date in the future
    $days = (int)((mktime (0,0,0,$month,$day,$year) - time(void))/86400);
    
    echo "There are $days days until $day/$month/$year";
    

提交回复
热议问题