RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.WithinPastMonths Function

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

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

DateUtils

Call WithinPastMonths to determine whether the date specified by ANow is within AMonths months of the date specified by AThen.

Note: WithinPastMonths uses the MonthsBetween function, which means that fractional months do not count. If ANow and AThen are 2 and a half months apart, calling WithinPastMonths with AMonths set to 2 returns true.
 

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