0

I am creating a sort of ticketing system where cases are created and have a set time period to be answered in.

The start-time is stored in the database as a timestamp e.g. 2013-10-16 01:39:00, datetime field in mysql. There is also a resolve-by timestamp stored which could be set to 8 hours after the start-time.

When a case is either marked as resolved or put on hold a stop-time timestamp is stored in the database as well as a clock_stopped flag. This means that the 8 hour time countdown is stopped. When a case is no longer on hold or is re-opened then the time countdown is restarted. But its not to include the period of time which the clock was stopped. So the total time to resolve case remains 8 hours even if it was on hold for a day. Make sense?

What is the best way to work out elapsed time when including periods of time when the elapsed time is not counting down as above? Do I need to add in more fields to store in the database e.g. How would you do it?

user794846
  • 1,881
  • 5
  • 29
  • 72
  • Does that code work, and you want to do it better, or are you having a problem with it? – halfer Oct 16 '13 at 12:58
  • works but its not working the way it should. In fact forget the code. I just need an example of how it could be done. – user794846 Oct 16 '13 at 13:10
  • 1
    It would be best to reinstate that code in your question, so that people can advise you upon it; I am not sure there are ready-made examples on the web, unless someone writes it all for you. – halfer Oct 16 '13 at 13:56

0 Answers0