Source Code:
(back to article)
<?php $date1 = new DateTime('2023-03-03'); $date2 = new DateTime('2023-03-10'); $interval = $date1->diff($date2); echo $interval->format('%R%a days'); // outputs "+7 days"
Result:
Report an issue