WeekNosApart Function
Returns true No of Weeks, based on WeekNo, that the two dates are apart.

Unit
QESBPCSDateTime

Declaration
Function WeekNosApart(const DT1, DT2: TDateTime): Integer;

Description
A Negative result implies DT2 occurs before D1. Will return -999 if Dates from Different Years.

Parameters
DT1 First Date/Time to be processed.
DT2 Second Date/Time to be processed.

Category
Date/Time Arithmetic Routines
Week Based Arithmetic Routines

Implementation

function WeekNosApart (const DT1, DT2: TDateTime): Integer;
begin
     if Date2Year (DT1) <> Date2Year (DT2) then
          Result := -999
     else
          Result := Date2WeekNo (DT2) - Date2WeekNo (DT1);
End;


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