WithinPastDays indicates True if two TDateTime values are within the specified ADays number of days of each other.
WithinPastDays is used to determine whether the date specified by ANow is within ADays days of the date specified by AThen.
Fractional days do not count, so if ANow and AThen are two and a half days apart, calling WithinPastDays with ADays set to 2, returns True.
Declaration: function WithinPastDays(const ANow, AThen: TDateTime; const ADays: Integer): Boolean;
An example follows.