Jump to content

Breaking up and averaging time


Recommended Posts

I have an array of UTC times. Lets say its:

 

10:52:48

13:52:27

09:12:37

10:32:34

09:12:21

13:20:12

 

I need to find the average of the hours. I am trying to do a couple of things.

 

1.  Find the average

2.  Find out how many times that specific hour is in the array

3.  Convert that UTC hour, second, microsecond to the users specific timezone.

 

I am thinking something like this.  I haven't fixed it for an array as of yet.

 

$broken_time=explode(':','10:52:48');
$time=date('H:i:s',mktime(-6+$broken_time[0],0+$broken_time[1],0+$broken_time[2],0,0,0));
echo $time;

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/164800-breaking-up-and-averaging-time/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.