SubtractMonths Function |
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 RoutinesImplementation
function SubtractMonths (const DT: TDateTime; const Months: Extended): TDateTime; begin Result := AddMonths (DT, -1 * Months); End; |
|