Jun 08, 2016 08:04 AM
I am looking for a formula that can be used to determine the time worked. I have a table that is a “Check In / Out” which includes two fields in of Check in and Check out. Is there a formula that can be set in another field that will give the total time?
Bonus, is there a way to add ALL of the times from that table?
Jun 08, 2016 08:53 AM
Try DATETIME_DIFF(End, Start, ‘minutes’) between date fields, check time option.
The total(SUM) is already made by Airtable at the bottom line of the Airtable window.
Hope it helps
Jun 08, 2016 01:11 PM
Thanks! That seems to work. Is there a way to prevent an error when someone has not “checked out” yet? Since the check out field is blank until they would be done it gives an error in that entry and the SUM
Jun 08, 2016 03:14 PM
Just looked a bit closer and its not computing the time correctly :frowning:
Jun 08, 2016 03:32 PM
It works for me with ‘Hours’ or ‘Minutes’.
Can you check the fields format, just in case !
To prevent from calculating an empty field, you can insert a logical test:
IF({checked out},
DATETIME_DIFF({checked out}, {checked in} , ‘hours’), 0)
In case it doesn’t work feel free to show your calc !
Jun 08, 2016 08:58 PM
Thanks for trying to help. It is still computing the times wrong.
Jun 09, 2016 01:51 AM
In your date fields,
can you stick " Use the same time zone (GMT) for all collaborators "
and see if it 's better !
It must be On or OFF for the 2 date fields
Jun 10, 2016 09:44 AM
That was the issue :slightly_smiling_face: Changed them bit to Off and works perfect. thanks!!
Jul 08, 2016 01:20 AM
I was able to make use of this for my own purposes:
IF({checked out},
DATETIME_DIFF({checked out}, {checked in} , ‘hours’), 0) but I would like to also have the minutes not just the hour so right now if I go from 1:30 to 2:50 that should be 1hr 20mins (or 1.2?) but doing so only shows it in 1.0 and no minutes are considered.
Jul 08, 2016 07:11 AM
Hi Shannon_Mason,
I did something close to your calculation.
I used DATETIME_DIFF and MOD function to get minutes and seconds.
Here is my calc, you can try it with your own fields in place:
((((DATETIME_DIFF(TODAY(), {Date max}, ‘hours’) & "hrs, ") &
MOD(DATETIME_DIFF(TODAY(), {Date max}, ‘hours’), 60)) & " mins, “) &
MOD(DATETIME_DIFF(TODAY(), {Date max}, ‘minutes’), 60)) & " secs”