How to Get Number of Days Between Two Dates in PHP?
We may face a requirement like finding the difference between two dates or to get the number of days between two days.Using the date_diff function you can count days between two dates in PHP.
Use the following script calculates the difference between two dates using PHP and shows the days count.
$datetime1 = new DateTime(‘2017-5-28’);
$datetime2 = new DateTime(‘2017-5-11’);
//difference between two dates
$diff = date_diff($datetime1,$datetime2);
//Will print Days:17