ObjectPascal
IncYear
Function
Increments a TDateTime variable by a number of years DateUtils unit
 function IncYear ( const StartDate : TDateTime {; NumberOfYears : Integer = 1} ) : TDateTime;
Description
The IncYear function returns a TDateTime value that is NumberOfYears greater than the passed StartDateTime value.
 
The increment value is optional, being 1 by default.
 
After incrementing the year, if the day value is too high for that month/year, then it is reduced to the highest value for that month/year.
Notes
There is no DecYear function.

Instead, use IncYear with a negative increment.
Related commands
IncDay Increments a TDateTime variable by + or - number of days
IncMinute Increments a TDateTime variable by + or - number of minutes
IncMonth Increments a TDateTime variable by a number of months
IncSecond Increments a TDateTime variable by + or - number of seconds
IncMillisecond Increments a TDateTime variable by + or - number of milliseconds
 
Example code : Add and then subtract 2 years to an example date
var
  myDate : TDateTime;
begin
  // Set up our date to a leap year special day
  myDate := EncodeDate(2000, 02, 29);
  WriteLn('myDate = '+DateToStr(myDate));

  // Add 2 years to this date
  myDate := IncYear(myDate, 2);
  WriteLn('myDate + 2 years = '+DateToStr(myDate));

  // Subtract 2 years from this date
  myDate := IncYear(myDate, -2);
  WriteLn('myDate - 2 years = '+DateToStr(myDate));
end;
Show full unit code
   myDate = 29/02/2000
   myDate + 2 years = 28/02/2002
   myDate - 2 years = 28/02/2000