[fpc-pascal] Re: printing each Friday the 13 using Pascal

Howard Page-Clark hdpc at talktalk.net
Mon Aug 6 15:30:19 CEST 2012


On 06/8/12 1:32, leledumbo wrote:

Minor amendment needed to leledumbo's code to give Friday, and a five 
year range:

uses SysUtils;

const startYr: word = 2012;

var dt: TDateTime;
     year, month: word;

begin
   for year in [0..4] do
    for month in [1..12] do
     begin
       dt := EncodeDate(startYr + year, month, 13);
       if (DayOfWeek(dt) = 6) then
        begin
    	 writeln(FormatDateTime('DDDD, DD-MM-YYYY',dt));
        end;
     end;
end.

Howard



More information about the fpc-pascal mailing list