Formula for subtracting one date from another to get a whole number


#1

I am looking for the correct formula for the following:

[Field] Time off End - [Field] Time off Start = [Field] number of days

i.e. 11/15/17 - 11/18/17 = 4

I realize the result of the calculation might be 3, since the 18th is not included, but I should be able to add + 1 to the formula to get the desired result.

I have tried various formula, but have not stumbled across the correct one.

Thanks for any advice on this topic.

Gordon Peery


#2

What you’re looking for is DATETIME_DIFF() — in this case, DATETIME_DIFF(Date1,Date2,'days').

That ‘days’ could also be ‘d’ — or any one of 18 other possible unit specifiers.

Airtable has an impressively rich collection of date and time functions. Just the possibilities offered by DATETIME_PARSE() (see here for more info) could keep you busy for days.


#3

Thank you. It’s working.