Calculate the difference between two time fields.

  • 0
  • 1
  • Question
  • Updated 1 year ago
  • Answered
I have two time fields that I am trying to calculate the difference between. 

Time in
Time out

My calculation field is [Time Out]-[Time In]

It seemed simple enough, however, I have run into some issues when it comes to midnight. 

If I clock in at 5 pm and clock out at 12 am the calculation should be 7 hours. However, it is returning a value of -17 hours. 

Is there a way to get this to calculate properly. 

I should mention that I would also want it to work if I clock in at 12 am and out at 2 pm it should give me a value of 14 hours. 

Any help would be greatly appreciated.
Photo of Andreonna

Andreonna

  • 1,040 Points 1k badge 2x thumb

Posted 1 year ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 51,546 Points 50k badge 2x thumb
Not tested but try this

If([Time Out] > [Time In],[Time Out] - [Time In],
Hours(24) - ([Time In] - [Time Out]))
Photo of Andreonna

Andreonna

  • 1,040 Points 1k badge 2x thumb
This appears to have done the trick! Thank you!