# Discussions

View Only

## Calculate the difference between two time fields.

• #### 1.  Calculate the difference between two time fields.

Posted 08-02-2017 19:22
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.

• #### 2.  RE: Calculate the difference between two time fields.

Posted 08-02-2017 19:39
Not tested but try this

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

• #### 3.  RE: Calculate the difference between two time fields.

Posted 08-02-2017 19:45
This appears to have done the trick! Thank you!