# Date Calculation

## Recommended Posts

I have created a date calculation field and want it to automatically calculate two years minus a day from another field:

i.e. Date: 25/12/2008 Calculation: 24/12/2010

If I add 730 days to the first field I sometimes get the right calculation but not always. I suspect leap years come into the equation but I'm not sure how to deal with this. Any help would be greatly appreciated.

##### Share on other sites

Technically, two years minus a day would be =

Date ( Month ( YourDate ) ; Day ( YourDate ) - 1 ; Year ( YourDate ) + 2 )

I say "technically", because there can be more that one correct answer to what is "two years minus a day" away from February 28/29 - it's largely a matter of preference. The above formula will return Feb. 28 if YourDate happens to be Feb 29, and Feb 27 when YourDate is Feb 28 (even if the the year of the result is a leap year).

##### Share on other sites

Thanks for the reply, that's exactly what I was after. Easy when you know how I guess.

## Create an account

Register a new account