Anonymous user
Day of the week: Difference between revisions
→{{header|D}}
m (Improve zsh example) |
|||
Line 341:
writefln("Christmas comes on a sunday in %d",year);
}</lang>
=={{header|Delphi}}==
<lang delphi>
procedure IsXmasSunday(fromyear, toyear: integer);
var
i: integer;
TestDate: TDateTime;
outputyears: string;
begin
outputyears := '';
for i:= fromyear to toyear do
begin
TestDate := EncodeDate(i,12,25);
if dayofweek(TestDate) = 1 then
begin
outputyears := outputyears + inttostr(i) + ' ';
end;
end;
form1.label1.caption := outputyears;
end;
</lang>
Procedure called with year range to test and outputs a space-delimited array of years to a label. There is no error check that fromyear < toyear, but this is easily added.
output:
2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
=={{header|Factor}}==
|