function DaysPerMonth(AYear, AMonth: Integer): Integer;

const

DaysInMonth: array[1..12] of Integer =

(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

begin

Result := DaysInMonth[AMonth];

if (AMonth = 2) and IsLeapYear(AYear) then Inc(Result); { leap-year Feb is special }

end;

procedure DateDiff(Date1, Date2: TDateTime; var Days, Months, Years: Word);

{ Corrected by Anatoly A. Sanko (2:450/73) }

var

DtSwap: TDateTime;

Day1, Day2, Month1, Month2, Year1, Year2: Word;

begin

if Date1 > Date2 then begin

DtSwap := Date1;

Date1 := Date2;

Date2 := DtSwap;

end;

DecodeDate(Date1, Year1, Month1, Day1);

DecodeDate(Date2, Year2, Month2, Day2);

Years := Year2 - Year1;

Months := 0;

Days := 0;

if Month2 < Month1 then begin

Inc(Months, 12);

Dec(Years);

end;

Inc(Months, Month2 - Month1);

if Day2 < Day1 then begin

Inc(Days, DaysPerMonth(Year1, Month1));

if Months = 0 then begin

Dec(Years);

Months := 11;

end

else Dec(Months);

end;

Inc(Days, Day2 - Day1);

end;

function MonthsBetween(Date1, Date2: TDateTime): Double;

var

D, M, Y: Word;

begin

DateDiff(Date1, Date2, D, M, Y);

Result := 12 * Y + M;

if (D > 1) and (D < 7) then Result := Result + 0.25

else if (D >= 7) and (D < 15) then Result := Result + 0.5

else if (D >= 15) and (D < 21) then Result := Result + 0.75

else if (D >= 21) then Result := Result + 1;

end;

this should be it...