DateTime.AddMonths

Syntax

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

Parameters

Value - initial date.

Count - the number of added months.

Description

The AddMonths method adds the specified number of months 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.AddMonths(DT, 1);

DT2 := DateTime.AddMonths(DT, 14);

End Sub Main;

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

"DT" - "01.01.2004"

"DT1" - "01.02.2004"

"DT2" - "01.03.2005"

See also:

DateTime