SubtractQuarters Function |
Unit
QESBPCSDateTime
Declaration
Function SubtractQuarters(const DT: TDateTime; const Qtrs: Extended): TDateTime;
Description
Fractional portion of Quarter is assumed to be related to 30 day month, as the AddMonths routine is used. Time portion preserved.
If Subtracting Quarters 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 Quarter Subtracted. The fractional part always is Subtracted from the resultant Date/Time.
Parameters |
DT | Date/Time to process. |
Qtrs | Number of Quarters to Subtract - can be negative. |
Category
Date/Time Arithmetic RoutinesImplementation
function SubtractQuarters (const DT: TDateTime; const Qtrs: Extended): TDateTime; begin Result := AddMonths (DT, Qtrs * -3); End; |
|