Day of the week: Difference between revisions

m
{{out}}
m (→‎{{header|Scala}}: Rm Scala imp category)
m ({{out}})
Line 32:
enddo.
</lang>
{{out}}
Output:
<pre style="height:30ex;overflow:scroll">
December 25 is a Sunday in:
Line 66:
end loop;
end Yuletide;</lang>
{{out}}
Sample output:
<pre style="height:30ex;overflow:scroll">
2011-12-25 00:00:00
Line 116:
)
</lang>
{{out}}
Output:
<pre>
December 25th is a Sunday in: 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
Line 231:
)
& done;</lang>
{{out}}
Output:
<pre>2011-12-25
2016-12-25
Line 297:
return 0 ;
}</lang>
{{out}}
This produces the following output:
<pre>
Yuletide holidays must be allowed in the following years:
Line 569:
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.
 
{{out}}
output:
<pre>
2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
</pre>
 
=={{header|ECL}}==
Line 670 ⟶ 672:
end for
</lang>
{{out}}
Output
<pre>
2011
Line 810 ⟶ 812:
END PROGRAM YULETIDE</lang>
{{out}}
Output
<pre>
25th of December is a Sunday in 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
</pre>
 
=={{header|GAP}}==
Line 852 ⟶ 856:
}
}</lang>
{{out}}
Output:
<pre>
25 December 2011 is Sunday
Line 881 ⟶ 885:
<lang groovy>println yuletide(2008, 2121)</lang>
 
{{out}}
Output:
<pre>[2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]</pre>
 
Line 894 ⟶ 898:
main = mapM_ putStrLn ["25 December " ++ show year ++ " is Sunday"
| year <- [2008..2121], isXmasSunday year]</lang>
{{out}}
Output:
<pre>
25 December 2011 is Sunday
Line 937 ⟶ 941:
main = mapM_ putStrLn ["25 December " ++ show year ++ " is Sunday"
| year <- [2008..2121], isXmasSunday year]</lang>
Output{{out}} on 32-bit machine:
<pre>
25 December 2011 is Sunday
Line 1,016 ⟶ 1,020:
end</lang>
 
{{out}}
Sample Output:
<pre>December 25th is a Sunday in: 2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118</pre>
 
Line 1,041 ⟶ 1,045:
}
}</lang>
{{out}}
Output:
<pre>Sun Dec 25 00:00:00 CST 2011
Sun Dec 25 00:00:00 CST 2016
Line 1,066 ⟶ 1,070:
console.log(year)
}</lang>
{{out}}
output:
<pre>2011
2016
Line 1,143 ⟶ 1,147:
end</lang>
 
{{out}}
Output:
<pre>
2011
Line 1,185 ⟶ 1,189:
`ifelse(eval(julianxmas(yr)%7==6),1,`yr ')')</lang>
 
{{out}}
Output:
<pre>
2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112
Line 1,204 ⟶ 1,208:
 
 
{{out}}
Output:
<pre> ans =
2011
Line 1,272 ⟶ 1,276:
END Yule.</lang>
 
{{out}}
Output:
<pre>
25th of December 2011 is Sunday
Line 1,341 ⟶ 1,345:
return
</lang>
{{out}}
;Output
<pre>
Between 2008 and 2121, Christmas day falls on a Sunday on the following years:
Line 1,540 ⟶ 1,544:
return (D + (N // D)) // D
</lang>
{{out}}
;Output
<pre>
Between 2008 and 2121, Christmas day falls on a Sunday in the following years:
Line 1,562 ⟶ 1,566:
if getLocalTime(timeInfoToTime timeinfo).weekday == dSun:
stdout.write year," "</lang>
{{out}}
Output:
<pre>2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118 </pre>
 
Line 1,593 ⟶ 1,597:
}</lang>
 
{{out}}
Output:
 
<pre>
25 Dec 2011 is Sunday
Line 1,638 ⟶ 1,641:
with _ -> ()</lang>
 
The output{{out}} of a run on a 32 bit machine is
 
<pre>
25 December 2011 is Sunday
Line 1,673 ⟶ 1,675:
List.iter (Printf.printf "%d\n") years</lang>
 
{{out}}
Output:
 
<pre>$ ocaml unix.cma str.cma -I +calendar calendarLib.cma xmas_sundays.ml
December 25 is a Sunday in:
Line 1,734 ⟶ 1,735:
exit 0;</lang>
 
{{out}}
Output:
 
<pre>
25 Dec 2011 is Sunday
Line 1,778:
 
exit 0;</lang>
{{out}}
Output:
 
<pre>
25 Dec 2011 is Sunday
Line 1,809 ⟶ 1,808:
 
0;</lang>
{{out}}
Output:
<pre>2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118</pre>
 
Line 1,833 ⟶ 1,832:
?></lang>
 
{{out}}
Output:
 
<pre>
25 Dec 2011 is Sunday
Line 1,859 ⟶ 1,857:
(when (= "Sunday" (day (date Y 12 25)))
(printsp Y) ) )</lang>
{{out}}
Output:
<pre>2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118</pre>
 
=={{header|Pike}}==
<lang Pike>filter(Calendar.Year(2008)->range(Calendar.Year(2121))->years()->month(12)->day(25), lambda(object day){ return day->week_day()==7; })->year()->format_nice();</lang>
{{out}}
Output:
<pre>
Result: ({ /* 17 elements */
"2011",
Line 1,884 ⟶ 1,883:
"2118"
})
</pre>
 
=={{header|PL/I}}==
Line 1,920:
</#></lang>
 
{{out}}
''Output''
<pre>Christmas Day 2011 is a Sunday
Christmas Day 2016 is a Sunday
Line 1,955:
print '\n'.join(days)
 
yuletide()</lang>Output:
{{out}}
<pre>25 Dec 2011
25 Dec 2016
Line 2,021 ⟶ 2,022:
]</lang>
 
{{out}}
Output:
 
<pre>2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118</pre>
 
Line 2,048:
2112
2118</pre>
 
===using DATE base===
The extended DATE parameters (arguments 2 and 3) are only supported by the newer REXX interpreters.
Line 2,054 ⟶ 2,055:
end</lang>
'''output''' is the same as above
<br><br>
 
===using DATE iso===
The extended DATE parameters (arguments 2 and 3) are only supported by the newer REXX interpreters.<br><br>
<br><br>Language note: the DATE built-in function always returns the day-of-week in English, no matter what the native language is in effect.
<lang rexx>/*REXX program displays which years December 25th falls on a Sunday. */
parse arg start finish . /*get the start and finish years.*/
Line 2,073:
end /*y*/
/*stick a fork in it, we're done.*/</lang>
'''output'''{{out}} when using the default input
<pre style="height:15ex;overflow:scroll">
December 25th, 2011 falls on a Sunday.
Line 2,110:
yL=left(y,2); yr=right(y,2); w=(d + (m+1)*26%10+yr+yr%4+yL%4+5*yL) // 7
if w==0 then w=7; return w /*Sunday=1, Monday=2, ... Saturday=7*/</lang>
'''output'''{{out}} using the default input
<pre style="height:15ex;overflow:scroll">
December 25th, 2011 falls on a Sunday.
Line 2,137:
puts "25 Dec #{year}" if Date.new(year, 12, 25).wday == 0 # Ruby 1.9: if Date.new(year, 12, 25).sunday?
end</lang>
{{out}}
Output:
<pre>
25 Dec 2011
Line 2,338:
end for;
end func;</lang>
{{out}}
Output:
<pre>
Christmas comes on a sunday in 2011
Line 2,366:
]</lang>
 
{{out}}
Output:
<pre>25-Dec-2011
25-Dec-2016
Anonymous user