<?php
function dateDiffDays($date1, $date2) {
$diff = strtotime($date2) - strtotime($date1);
return abs(round($diff / 86400));
}
$date1 = "01-10-2021";
$date2 = "11-10-2021";
$dateDiff = dateDiffDays($date1, $date2);
printf("Difference between two dates: ". $dateDiff . " Days ");
?>
Output -
Difference between two dates: 10 Days
1 comment:
This site is so amazing, This sites gives good knowledge of PHP , This is very helpful for me. Here all content so useful and helpful for beginner and experience both.
Post a Comment