I am trying to add two DateInterval objects together. The DateInterval->add() method does not exist, but I'd like to do something like this:
$interval1 = new DateInterval('PT2H47M13S');
$interval2 = new DateInterval('PT4H19M22S');
$interval1->add($interval2);
echo $interval1->format('%hh %im %ss');
Results in: 7h 6m 35s
I understand I can create a new class that extends the DateInterval class and write the method for adding the 2 together myself. But, the DateInterval objects I am using are coming from the return value of date_diff(). So unless there is someway to convert the DateInterval object cleanly into the extended class, I'm not sure what to do.