Help

Re: How to get the difference of minutes of two fields?

2199 6
cancel
Showing results for 
Search instead for 
Did you mean: 
Andrey_Lyovushk
6 - Interface Innovator
6 - Interface Innovator

There are 2 fields of type “Data”.
Screenshot_1
What formula should be written for field 3 so that the difference in minutes between the fields ‘Date1’ and ‘Date2’ is calculated there?

7 Replies 7

IF(
AND(date2,date1),
DATETIME_DIFF(date2, date1, 'minutes')
)

No.itog

Looks like you’ve got your date fields setup incorrectly. You’ll need to go into your customization options for your date fields, and make sure they’re both set to either GMT or not. They both need to be set to the exact same option. You can’t have one field set to GMT and the other field set to NON-GMT, because then you’re telling Airtable that your fields are in 2 different time zones.

They are the same
time1
time2

I wasn’t looking too carefully at the actual dates you typed in, but the formula that I gave you is giving you the exact number of minutes that have elapsed between Date 1 and Date 2. Are you saying that you want it to completely ignore the dates altogether and just look at the times?

Yes. I just need time. The day of the month and year can be left alone

If you’re ignoring the dates, then I would probably do it like this.

This formula will extract the time from the date fields as 24-hour military time, and then the math can be done on those military times:

IF(

AND(Date2,Date1),    

DATETIME_DIFF(
DATETIME_PARSE(TIMESTR(Date2),'HH:mm'),
DATETIME_PARSE(TIMESTR(Date1),'HH:mm'),
'minutes'
)

)