RE: Displaying Time Intervals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pablo Gosse <mailto:gossep@xxxxxxx>
    on Thursday, April 07, 2005 2:49 PM said:

> Can anyone give me some advice on the best way to display intervals of
> time?
[snip/]
> Then, cumulatively for each day, I want to display the total time,
> also in the format of H:i:s.
> 
> Can anyone give me some advice on how to do this?
[snip/]
> Is there an existing class that provides such functionality, or
> should I just write one myself?

If I understand you (which I'm not sure that I do) I think you need to
write it yourself.

You need to find the total number of seconds for the entire day by
adding up the differences between the start time and end time of each
session. Once found pass then pass that number to a function that
calculates the length. That shouldn't be too hard since this part won't
have anything to do with time zones, or DST.

In case this helps here are some numbers:

60 is the number of seconds in one minute. (duh!)
60*60 is the number of seconds in one hour.
60*60*24 is the number of seconds in one hour.
60*60*24*30 is the number of seconds in one month*.
60*60*24*365 is the number of seconds in one year.

HTHAIHIGATNR**,
Chris.

* Using an even average of 30 days per month.
** Hope That Helps, And I Hope I Got All Those Numbers Right.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux