Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Calculating the difference in time between two date fields

9778 13
cancel
Showing results for 
Search instead for 
Did you mean: 
AmeriCorps_Volu
6 - Interface Innovator
6 - Interface Innovator

Hey all! I have recently started using Airtable and I have been searching for an answer to this question for too long.
I am attempting to track volunteer hours. I have a form that people will complete every time they have a “shift”. This form asks people when they came in and when they left. I want to create a formula that finds the difference of the End time and the Start time in order to find the total time of their shift.
I have read through several ask the community questions similar to this and tried several formulas; including DATETIME_DIFF. However, nothing seems to be working.
Please help! Thanks in advance.
image.png
image.png

13 Replies 13
AmeriCorps_Volu
6 - Interface Innovator
6 - Interface Innovator

I am at the point of almost leaving a question in the form that asks for the volunteer to put the duration of their shift. However, I would much rather have airtable do so automatically.

You just need to use commas to separate the parameters you pass into the DATETIME_DIFF() function:

DATETIME_DIFF(
   {End Time},
   {Start Time},
   'hours'
)

image
It’s only giving me -0, I’m not sure why

Nevermind! I used ‘minutes’ instead of hours & it worked! Thank you!!

So you should get hours * 60, and not -0 :thinking:

I had used this formula: 05%20PM And it seemed to be working fine, but now it’s giving me negative results. Screen Shot 2019-02-05 at 3.30.47 PM.png
So I tried the ‘hours’ * 60 and it gave me an error. 16%20PM Any clue what am I doing wrong?

Yes, you have those Starts after the corresponding Ends, instead of before (they maybe are swapped).

What I meant with ‘hours * 60’ was that, if you expect for instance to get a 6 because your want to get hours, when you specify minutes, the number should be 360, what is 6 multiplied by 60.

SO swapping just swapped which records came out positive/negative. 60 & 360 both gave me errors.

Okay I didn’t realize ‘*360’ had to be written with a comma. So I put the comma & the negatives do not change…