Help

How to calculate days until date and add/subtract days to that formula

Topic Labels: Formulas
282 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Caitlyn_Irwin
6 - Interface Innovator
6 - Interface Innovator

Hi, I'm trying to calculate the number of days until a date, however the result isn't correct.

I think using the term TODAY is causing issues due to the difference of my time zone compared to Airtable's. Is there a way to add the time zone into the formula, or can I add/subtract days somehow?

Here's the formula I am using;

 

 

DATETIME_DIFF(
  Date,
  TODAY(),
  'days'
)

 

 

 
2 Replies 2
Mike_AutomaticN
6 - Interface Innovator
6 - Interface Innovator

I should play around with the formula. But did you try using Now() rather that Today()?

If that still doesn’t work you can always use the Dateadd formula to adjust as needed.

The TODAY() function returns a value with the time of GMT midnight. If you are in a different timezone, this can make math off by a day. DATETIME_DIFF() also looks for complete 24 hour periods when calculating how far apart the days are, which might not be what you want.

Whether or not adding (or subtracting) a day from the difference will work depends on how far you are from GMT and what time of day you will be referring to the result. If you choose to add/subtract a day from teh difference, it easiest done after you already calculate the difference.

Airtable has a SET_TIMEZONE() function that can set the timezone when formatting date/time values. However, it does not actually change the underlying value.