Aug 21, 2024 04:34 PM
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'
)
Aug 21, 2024 05:42 PM
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.
Aug 21, 2024 09:21 PM
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.