How to calculate the date six months from the current date in Pascal

1 Answer

0 votes
program FutureDateCalculator;
uses SysUtils, DateUtils;

function CalculateFutureDate(MonthsToAdd: Integer): TDateTime;
begin
  CalculateFutureDate := IncMonth(Now, MonthsToAdd);
end;

var 
  futureDate: TDateTime;

begin
  // Calculate future date
  futureDate := CalculateFutureDate(6);

  // Print the new date
  WriteLn('Date six months from now: ', FormatDateTime('yyyy-mm-dd', futureDate));
end.
 
 
 
(*
run:
 
Date six months from now: 2025-12-11
 
*)

 



answered Jun 11, 2025 by avibootz

Related questions

1 answer 147 views
1 answer 97 views
1 answer 64 views
1 answer 173 views
...