RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
DateUtils.MonthsBetween Function

Returns the approximate number of months between two specified TDateTime values.

Pascal
function MonthsBetween(const ANow: TDateTime; const AThen: TDateTime): Integer;
C++
int MonthsBetween(const TDateTime ANow, const TDateTime AThen);

DateUtils

Call MonthsBetween to obtain the difference, in months, between two TDateTime values. Because months are not all the same length, MonthsBetween returns an approximation based on an assumption of 30.4375 days per month. Fractional months are not counted. Thus, for example, MonthsBetween reports the difference between Feb 1 and Mar 1 as 0. 

 

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