way OT: Time extraction

Jamie Bohr jamiebohr at gmail.com
Fri Jun 1 16:44:16 UTC 2007

Sorry the below is so off topic, I posted it to a PHP/MySQL forum and have
not gotten a response and was hoping some one here could point me to a
resource.  The manager that is asking for this says M$ Excel can do what he
is asking, I have my doubts that is can.

I have a request to produce a report for server availability for business
hours only, M-F 8AM-5PM. I have an example table below that houses all the
data but am having trouble understanding how to extract the data.

The table looks something like:

id startDate startTime endDate endTime
1 2007-03-01 06:00:00 2007-05-01 17:00:00
2 2007-04-16 09:30:00 2007-04-16 13:00:00
3 2007-05-23 00:00:00 2007-05-26 19:00:00

id represents a system

system 1 was down for a total of 198 hours between 3/01 - 3/31. 22 workdays
* 9 hours a day

system 2 was down for a total of 3.5 hours

system 3 was down for 24 hours

I can do it by hand, how do I do it using SQL/PHP? What if I wanted a report
that showed downtime for April? system one would have a down time figure of
189 hours + systems 2 downtime of 3.5 hours. (567 workhours - 189 hours down
for system 1 - 3.5 hours for system 2) / 567 * 100 = % system were

Please tell me there is an easy way to calculate the hours of downtime? And
in that vain the number of working hours in a given month.

Jamie Bohr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070601/7e610923/attachment-0003.htm>

More information about the fedora-list mailing list