SubtractSemesters Function
Subtracts a Floating Point amount of Semesters from a Given Date/Time.

Unit
QESBPCSDateTime

Declaration
Function SubtractSemesters(const DT: TDateTime; const Sems: Extended): TDateTime;

Description
Fractional portion of Semester is assumed to be related to 30 day month, as the AddMonths routine is used. Time portion preserved.

If Subtracting Semesters 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 Semeters Subtracted. The fractional part always is Subtracted from the resultant Date/Time.

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

Category
Date/Time Arithmetic Routines

Implementation

function SubtractSemesters (const DT: TDateTime; const Sems: Extended): TDateTime;
begin
     Result := AddMonths (DT, Sems * -6);
End;


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