I have two date interval object, is there any default method to add those interval object ?
$date1 = date_create("2013-03-15");
$date2 = date_create("2013-12-12");
$diff_1=date_diff($date1,$date2);
echo $diff_1->format("%y years").' '.$diff_1->format("%m months"). ' ' . $diff_1->format("%d days");
//0 years 8 months 27 days
$date3 = date_create("2015-02-15");
$date4 = date_create("2015-12-12");
$diff_2=date_diff($date3,$date4);
echo $diff_2->format("%y years").' '.$diff_2->format("%m months"). ' ' . $diff_2->format("%d days");
//0 years 9 months 27 days
$diff_1+$diff_2
= 1 year 6 months 24 days
What i need is to calculate the sum of diff_1
and diff_2
?