Sign in Join
FPDoc Onlineexperiment

IncYear function

In unit DateUtils

Increase a TDateTime value with a number of years.

Declaration

pascal
function IncYear(const AValue: TDateTime; const ANumberOfYears: Integer)
: TDateTime

Arguments

AValue

TDateTime to which years should be added.

ANumberOfYears

Number of years to add.

Function result

TDateTime representing AValue plus ANumberOfYears years.

Description

IncYear adds ANumberOfYears years to AValue and returns the resulting date/time. ANumberOfYears can be positive or negative.

See also

Example: ex71

pascal
Program Example71;

{ This program demonstrates the IncYear function }

Uses SysUtils,DateUtils;

Begin
  Writeln('One year from today is ',DateToStr(IncYear(Today,1)));
  Writeln('One year ago from today is ',DateToStr(IncYear(Today,-1)));
End.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.