System.DateUtils.YearSpan

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function YearSpan(const ANow, AThen: TDateTime): Double;

C++

extern DELPHI_PACKAGE double __fastcall YearSpan(const System::TDateTime ANow, const System::TDateTime AThen);

Properties

Type Visibility Source Unit Parent
function public
System.DateUtils.pas
System.DateUtils.hpp
System.DateUtils System.DateUtils

Description

Returns the approximate number of years (including fractions thereof) between two specified TDateTime values.

Call YearSpan 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. Unlike the YearsBetween function, which does not report fractional years, YearSpan reports incomplete years as a fraction of a 365.25-day year.

YearSpan always returns a positive result and therefore the parameter values are interchangeable.

See Also


Code Examples