Skip to main content

How to get the difference of minutes of two fields?

  • August 10, 2020
  • 7 replies
  • 67 views

There are 2 fields of type “Data”.

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

ScottWorld
Forum|alt.badge.img+35
  • Genius
  • August 10, 2020

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


  • Author
  • Participating Frequently
  • August 11, 2020

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


No.


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • August 11, 2020

No.


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.


  • Author
  • Participating Frequently
  • August 11, 2020

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


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • August 11, 2020

They are the same


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?


  • Author
  • Participating Frequently
  • August 11, 2020

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


ScottWorld
Forum|alt.badge.img+35
  • Genius
  • August 11, 2020

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'
)

)