...get the difference between 2 dates?

Author: Simon Grossenbacher
Homepage: http://www.swissdelphicenter.ch

Category: Math

procedure TForm1.Button1Click(Sender: TObject);
var
  
date1, date2: TDateTime;
  difference: Integer;
begin
  
date1 := EncodeDate(2000, 06, 15);  //Date 2000/06/15
  
date2 := EncodeDate(2000, 01, 01);  //Date 2000/01/01

  
difference := trunc(date1) - trunc(date2);
  ShowMessage(IntToStr(difference));
end;

 

printed from
www.swissdelphicenter.ch
developers knowledge base