Calculate the difference between two dates in days.
Source Code
$startDate = new DateTime("2023-01-01");
$endDate = new DateTime("2023-01-31");
$interval = $startDate->diff($endDate);
echo "Difference : " . $interval->days . " days";
Calculate the difference between two dates in days.
$startDate = new DateTime("2023-01-01");
$endDate = new DateTime("2023-01-31");
$interval = $startDate->diff($endDate);
echo "Difference : " . $interval->days . " days";