System.DateUtils.MonthsBetween

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function MonthsBetween(const ANow, AThen: TDateTime): Integer;

C++

extern DELPHI_PACKAGE int __fastcall MonthsBetween(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 between two specified TDateTime values.

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 February 1 and March 1 as 0.

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

See Also


Code Examples