| AgeAtDateInWeeks Function | 
Unit
QESBPCSDateTime
Declaration
Function AgeAtDateInWeeks(const DOB, DT: TDateTime): Integer;
Description
If DT occurs before DB then -1 is returned. Routine donated by David Gobbett.
| Parameters | 
| DOB | Date of Birth. | 
| DT | Date in question. | 
Returns
Age in Integral Weeks at the Date in question.
Category
Date/Time Arithmetic Routines
Week Based Arithmetic RoutinesImplementation
 
| function AgeAtDateInWeeks (const DOB, DT: TDateTime): Integer;
begin
     if DT < DOB then
          Result := -1
     else
     begin
          Result := Trunc (DT - DOB) div 7;
     end; {else}
End; | 
|  |