Skip to content

IncYear

Increase a TDateTime value with a number of years.

Declaration

Source position: dateutil.inc line 284

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

Description

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

See also

Name Description
IncDay Increase a TDateTime value with a number of days.
IncHour Increase a TDateTime value with a number of hours.
IncMilliSecond Increase a TDateTime value with a number of milliseconds.
IncMinute Increase a TDateTime value with a number of minutes.
IncSecond Increase a TDateTime value with a number of seconds.
IncWeek Increase a TDateTime value with a number of weeks.
#rtl.sysutils.IncMonth Increases the month in a TDateTime value with a given amount.

Example

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.