DateTime.AddYears

Syntax

AddYears(Value: DateTime; Count: Integer): DateTime;

Parameters

Value. Initial date

Count. The number of added years.

Description

The AddYears adds the specified number of years to the initial date.

Example

Sub UserProc;
Var
    DT, DT1, DT2: DateTime;
Begin
    DT := DateTime.Parse("01.01.2004 00:00:00");
    DT1 := DateTime.AddYears(DT, 1);
    DT2 := DateTime.AddYears(DT, -3);
End Sub UserProc;

After executing the example the "DT", "DT1", "DT2" variables contain the following values:

"DT" - "01.01.2004"

"DT1" - "01.01.2005"

"DT2" - "01.01.2001"

See also:

DateTime