Jump to content

[SOLVED] Time calculation


php_dave

Recommended Posts

Guys,

 

Sorry to dump this on you but its driving me mental!

 

I am storing the time of an outage that is attached to a ticket.

I am also storing the SLA time of a service for a customer.

 

For example

 

Customer A using Service A between the hours 08:00 17:00

Outage ticket for service A was between 07:00 - 09:00.

 

The full outage time for the service was 2hrs ( i can find this out by doing datediff(endtime,starttime) - easy but I cant work out how to find out the outage time for the service for customer A - which in the real wolrd is only 1hr 08:00 till 09:00....

 

Hope this makes sense  ??? - I have been staring at my query builder for 8 hours now and just cant work it out!

Link to comment
https://forums.phpfreaks.com/topic/118290-solved-time-calculation/
Share on other sites

two IFs in the query might help - take the latest of both start times, the earliest of both end times when calculating the time difference.  that will allow you to calculate the difference between 0900 and 0800 in this case, for example.

 

this approach will only work for full block service times, since gaps will affect the calculation obviously.

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.