Day of the week of Christmas and New Year: Difference between revisions

no edit summary
(added RPL)
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 794:
<pre>25.12.2021 is a Saturday
01.01.2022 is a Saturday<</pre>
 
=={{header|Pascal}}==
==={{header|Free Pascal}}===
<syntaxhighlight lang="pascal">
Program daysofweek;
Uses sysutils;
 
Const Years : array Of integer = (1578, 1590, 1642, 1957, 2020, 2021, 2022, 2242, 2245, 2393);
 
Var christmasday, newyearsday : tdatetime;
year : integer;
Begin
For year In years Do
Begin
christmasday := encodeDate(year,12,25);
newyearsday := encodeDate(year,1,1);
writeln('in ',year,' New Years day is on ',DefaultFormatSettings.LongDayNames[DayOfWeek(
newyearsday)],', and Christmas day on a ',DefaultFormatSettings.LongDayNames[DayOfWeek(
christmasday
)]);
End;
End.
</syntaxhighlight>
{{out}}
<pre>
in 1578 New Years day is on Sunday, and Christmas day on a Monday
in 1590 New Years day is on Monday, and Christmas day on a Tuesday
in 1642 New Years day is on Wednesday, and Christmas day on a Thursday
in 1957 New Years day is on Tuesday, and Christmas day on a Wednesday
in 2020 New Years day is on Wednesday, and Christmas day on a Friday
in 2021 New Years day is on Friday, and Christmas day on a Saturday
in 2022 New Years day is on Saturday, and Christmas day on a Sunday
in 2242 New Years day is on Saturday, and Christmas day on a Sunday
in 2245 New Years day is on Wednesday, and Christmas day on a Thursday
in 2393 New Years day is on Friday, and Christmas day on a Saturday
</pre>
 
 
=={{header|Perl}}==
Line 1,081 ⟶ 1,118:
 
The above module uses the Gregorian Proleptic calendar and therefore gives the wrong days of the week for 1578 as the earliest year for the adoption of the Gregorian calendar was 1582 when 10 days (from 5th until 14th October inclusive) were omitted. To get the correct days for 1578 (and agree with the Ruby entry) we therefore need to add 10 days to the Gregorian date which the ''Date.fromJulian'' method does automatically.
<syntaxhighlight lang="ecmascriptwren">import "./date" for Date
 
System.print("Days of week per Gregorian Proleptic calendar:")
44

edits