Returns the approximate number of years between two specified TDateTime values.
Unit
DateUtils
Category
date/time routines
function YearsBetween(const ANow, AThen: TDateTime): Integer;
Description
Call YearsBetween to obtain the difference, in years, between two TDateTime values. Because years are not all the same length (e.g. leap years), YearsBetween returns an approximation based on an assumption of 365.25 days per year. Fractional years are not counted. Thus, for example, YearsBetween reports the difference between Jan 1 and Dec 31 as 0 on non-leap years and 1 on leap years.