RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.WithinPastYears Function

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

Pascal
function WithinPastYears(const ANow: TDateTime; const AThen: TDateTime; const AYears: Integer): Boolean;
C++
Boolean WithinPastYears(const TDateTime ANow, const TDateTime AThen, const int AYears);

DateUtils

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 2 and a half years apart, calling WithinPastYears with AYears set to 2 returns true.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!