SubtractMonths Function
Subtracts a Floating Point amount of Months from a Given Date/Time.

Unit
QESBPCSDateTime

Declaration
Function SubtractMonths(const DT: TDateTime; const Months: Extended): TDateTime;

Description
Fractional portion of Month is assumed to be related to 30 day months. Time portion preserved.

If Subtracting Months results in landing on a nonsense date like 31 Apr then the last day in the month is used. This only applies to the integral component of the Months Subtracted. The fractional part always is Subtracted from the resultant Date/Time.

Parameters
DT Date/Time to process.
Months Number of Months to Subtract - can be negative.

Category
Date/Time Arithmetic Routines
Month Based Arithmetic Routines

Implementation

function SubtractMonths (const DT: TDateTime; const Months: Extended): TDateTime;
begin
     Result := AddMonths (DT, -1 * Months);
End;


HTML generated by Time2HELP
http://www.time2help.com