Mar 03, 2024 10:20 AM - edited Mar 03, 2024 10:28 AM
Hello AT Community,
I am trying to write a formula that returns the number of years and days in between two dates. So for example, assuming {DoB} is 18 FEB 1994, DATETIME_DIFF(TODAY(),DoB,'years'),"y ") returns 30 which is correct.
I would also like to calculate the number of remaining days i.e. between the last full year (18 FEB 2024 and today). The answer should be 14 however this extract from my Airtable formula (MOD(DATETIME_DIFF(TODAY(),DoB,'days'),365),"d"))) is returning 21.
Can anyone tell me what I am doing wrong please?
Mar 03, 2024 01:55 PM
Looks like you are not accounting for leaps years in your formula. The total days in 30 years is not 30*365, it is 30*365+(30/4), which adds 7 additional days.
Mar 03, 2024 02:12 PM - edited Mar 03, 2024 02:14 PM
Hi Dan,
Thanks for your reply. In the meantime, this is the formula that I am using
Mar 03, 2024 02:24 PM
using your entire formula this data looks correct