Forum Discussion

AndreonnaGarret's avatar
AndreonnaGarret
Qrew Assistant Captain
8 years ago

Calculate the difference between two time fields.

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.
  • Not tested but try this

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