j'ai trouver ca sur internet :
function GetYMDBetween(FromDate, ToDate: TDateTime;
var Years, Months, Days: Integer): Boolean;
var
FromY, FromM, FromD, // from date
ToY, ToM, ToD: Word; // to date
TmpDate: TDateTime;
PreviousMonth: Byte;
DaysInMonth: Byte;
begin
Result := FromDate <= ToDate;
if not Result then
begin
TmpDate := ToDate;
ToDate := FromDate;
FromDate := TmpDate;
end;
DecodeDate(ToDate, ToY, ToM, ToD);
DecodeDate(FromDate, FromY, FromM, FromD);
Years := ToY - FromY;
Months := ToM - FromM;
Days := ToD - FromD;
if Days < 0 then
begin
Dec(Months);
PreviousMonth := ToM + (Byte(ToM = 1) * 12) - 1;
case PreviousMonth of
1,3,5,7,8,10,12: DaysInMonth := 31;
4,6,9,11 : DaysInMonth := 30;
else
DaysInMonth := 28 + Byte(IsLeapYear(ToY));
end;
Days := DaysInMonth - Abs(Days);
end;
if Months < 0 then
begin
Dec(Years);
Months := 12 - Abs(Months);
end;
end;
mais le resultat est booleen