Hello i need to calculate an average time between some DateInterval.
Actually i've some Dateinterval like this :
for ($i = 0 ; $i < count($startDate) ; $i++)
{
$diffTable[] = date_diff($finishDate[$i], $startDate[$i]);
echo $diffTable[$i]->format("%Y-%M-%d %H:%i:%s");
}
Here is the output :
00-00-0 00:13:17
00-00-0 00:7:47
00-00-0 00:7:14
00-00-0 00:10:39
I need to calculate the average time between this intervals. Here it's only minute and second, but it could be Month or year.
I can't find a good way to calculate it easily. i can simply add every dateInterval with a conversion like this :
sec + 60xmin + 3600xHour ...
And them play with Modulo (%).
But i hope there is another way ?