Select to view content in your preferred language

Calculate future date which takes leap years into consideration

239
0
07-04-2025 03:30 AM
Status: Open
narmour1979
Occasional Contributor

I have a customer who wants their survey form to calculate a future date (ExpiryDate) based on the inputted date (StartDate), and a term, which is expressed in years. The purpose is to automatically calculate the end of a lease agreement, so that reminders can be sent to the tenant. Leases can be anything from one year to 99 years. 

 

I have tried creating a formula which takes the term and divides it by four, then always rounds down which gives an approximation of how many leap years are in the term, which can be added to the calculation. There are problems with this approach though as it depends on 2 things; where the term starts in the leap year cycle, and whether or not the term begins before or after February 28th. Using this calculation we have noticed irregularities when changing the dates and testing both these scenarios. 

The idea is to have a function that can accurately calculate the end date of a term which takes leap years into account.