Calculate Number of Days Between Two Dates using PHP

DateTime::diff method

<?php

$startDate = new DateTime('2020-11-08');
$endDate = new DateTime('2020-11-10');

$diff = $endDate->diff($startDate);
$numberOfDays = $diff->days;

echo $numberOfDays;

Leave a Comment

Cancel reply

Your email address will not be published.