TheSaviour
Programmer
I have 2 dates and I want to compare them and get the number of days in between them. The dates start off as strings in the DD/MM/YYYY format,
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
uses DateUtils;
// ...
procedure TForm1.Button1Click(Sender: TObject);
var
dtBeg,
dtEnd : tDatetime;
intDays : integer;
begin
dtBeg := encodeDate( '1980', '01', '01' );
dtEnd := encodeDate( '2002', '09', '14' );
intDays := daysBetween( dtEnd, dtBeg );
messageBoxFmt( 'There are %d days between %s and %s.',
[ intDays, dateTimeToStr( dtBeg ),
dateTimetoStr( dtEnd ) ] );
end;