uses
DateUtils;
procedure TForm1.Button1Click(Sender: TObject);
var
date1: TDateTime;
date2: TDateTime;
begin
date1 := StrToDate(Edit1.Text);
date2 := StrToDate(Edit2.Text);
Label1.Caption := '两日期相差:' + IntToStr(DaysBetween(date1, date2)) + '天';
end;