System.DateUtils.WithinPastYears

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function WithinPastYears(const ANow, AThen: TDateTime;
const AYears: Integer): Boolean;

C++

extern DELPHI_PACKAGE bool __fastcall WithinPastYears(const System::TDateTime ANow, const System::TDateTime AThen, const int AYears);

Properties

Type Visibility Source Unit Parent
function public
System.DateUtils.pas
System.DateUtils.hpp
System.DateUtils System.DateUtils

Description

Indicates whether two date/time values are within a specified number of years of each other.

Call WithinPastYears to determine whether the date specified by ANow is within AYears years of the date specified by AThen.

Note: WithinPastYears uses the YearsBetween function, which means that fractional years do not count. If ANow and AThen are two and a half years apart, calling WithinPastYears with AYears set to 2 returns True.

See Also


Code Examples