System.DateUtils.MonthSpan

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

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

C++

extern DELPHI_PACKAGE double __fastcall MonthSpan(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 months, including fractions, between two specified TDateTime values.

Call MonthSpan 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. Unlike the MonthsBetween function, which does not report fractional months, MonthSpan reports incomplete months as a fraction of an entire month.

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

See Also


Code Examples