Hello, I have two times that I would like to find the Hours, Minutes, Seconds between. I am using the following code:

VB Code:
  1. Private Function TimeDiff(strTimeIn As String, strTimeOut As String)
  2. Dim hour As Long, min As Long, sec As Long
  3.  
  4.     sec = DateDiff("s", strTimeIn, strTimeOut)
  5.    
  6.     hour = Int(sec / 3600)
  7.     sec = sec - (hour * 3600)
  8.     min = Int(sec / 60)
  9.     sec = sec - (min * 60)
  10.     TimeDiff = Format(hour, "00") & ":" & Format(min, "00") & ":" & Format(sec, "00")
  11. End Function

It works if say I have a TimeIn of 8:00:00AM and a TimeOut of 12:00:00 PM...but if I have a TimeIn of say 01:00:00 PM and a TimeOut of 08:00:00AM (Time diff should be 19 hours)...I get a timediff of -5:00:00. It is going 'back' in time instead of forward. How can I fix this?