Skip to content

PeriodBetween

Return the period (in years, months, days) between two dates.

Declaration

Source position: dateutil.inc line 287

procedure PeriodBetween(const ANow: TDateTime; const AThen: TDateTime; 
                       out Years: Word; out months: Word; 
                       out days: Word);

Description

PeriodBetween returns the timespan between 2 dates (ANow and AThen), expressed as a number of years, months and days in the parameters Years, months and days. Only complete years, months and days are reported.

If ANow is before AThen, their values are reversed so the result is always positive.

See also

Name Description
YearsBetween Calculate the number of whole years between two TDateTime values.
MonthsBetween Calculate the number of whole months between two TDateTime values.
WeeksBetween Calculate the number of whole weeks between two TDateTime values.
DaysBetween Number of whole days between two TDateTime values.