DateTime.AddYears

Syntax

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

Parameters

Value - initial date.

Count - the number of added years.

Description

The AddYears method adds the specified number of years to the initial date passed as the Value parameter.

Example

Sub Main;

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 Main;

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

"DT" - "01.01.2004"

"DT1" - "01.01.2005"

"DT2" - "01.01.2001"

See also:

DateTime