How to check if a date is in the future with Free Pascal

1 Answer

0 votes
program FutureDateCheck;

{$mode objfpc}{$H+}

uses
  SysUtils;

{ Returns True if the specified date/time is in the future }
function IsFutureDate(const ADate: TDateTime): Boolean;
begin
  Result := ADate > Now;
end;

var
  TestDate: TDateTime;

begin
  { Example: 1 day in the future }
  TestDate := Now + 1;

  if IsFutureDate(TestDate) then
    WriteLn('The date is in the future.')
  else
    WriteLn('The date is not in the future.');
end.



{
run:

The date is in the future.

}

 



answered 6 hours ago by avibootz
...