procedure DiffDates(dFrom, dTo: TDateTime; var y,m,d,h,n,s,ms: Word);
begin
DecodeTime(dFrom-dTo, h,n,s,ms);
y := 0; m := 0; d := 0;
while IncMonth(dFrom,12*y) < dTo do
Inc(y);
if IncMonth(dFrom,12*y) > dTo then
Dec(y);
dFrom := IncMonth(dFrom,12*y);
while IncMonth(dFrom,m) < dTo do
Inc(m);
if IncMonth(dFrom,m) > dTo then
Dec(m);
dFrom := IncMonth(dFrom, m);
while dFrom + d < dTo do
Inc(d);
if dFrom + d > dTo then
Dec(d);
end;
|