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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.