A TDateTime variable is essentially a double variable, and the order between two date and time values ββ(considered date and time values) is the same as the order between values ββconsidered to be real numbers.
procedure TForm4.FormCreate(Sender: TObject); var d1, d2, d: TDate; begin d1 := StrToDate('2012-07-25'); d2 := StrToDate('2012-07-29'); d := StrToDate('2012-07-26'); if (d1 <= d) and (d <= d2) then ShowMessage('In range!'); end;
Of course, using Math , you can also write
if InRange(d, d1, d2) then ShowMessage('In range!');
source share