procedure TForm1.TimeSetup1;
var
yr,mr,dr: Word;
td1,td2,dd: TdateTime;
begin
td1:=StrtoDate(Edit17.Text);
td2:=StrtoDate(Edit18.Text);
dd:=td2-td1;
decodedate(dd,yr,mr,dr);
if yr-1900<0 then
begin
time2:=dr-29;
end;
if yr-1900>=0 then
begin
if mr=3 then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+1;
end;
if (mr=1) or (mr=4) or (mr=5) then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+2;
end;
if (mr=2) or (mr=6) or (mr=7) then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+3;
end;
if mr=8 then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+4;
end;
if (mr=9) or (mr=10) then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+5;
end;
if (mr=11) or (mr=12) then
begin
time2:=(yr-1900)*365+(mr-1)*30+dr+6;
end;
end;
end;