Jump to content

Day of the week: Difference between revisions

Updated D entry
(Updated D entry)
Line 488:
 
void main() {
writeln("Christmas comes on a Sunday in the years:").writeln;
foreach iota(year; 2008 .., 2122) {
immutable d.filter!(y => Date.fromSimpleString(y.text(year) ~ "-Dec-25";).dayOfWeek ==
if (Date.fromSimpleString(d).dayOfWeek() == DayOfWeek.sun)
.writeln(year);
}
}</lang>
{{out}}
<pre>Christmas comes on a Sunday in the years:
[2011, 2016, 2022, 2033, 2039, 2044, 2050, 2061, 2067, 2072, 2078, 2089, 2095, 2101, 2107, 2112, 2118]</pre>
2011
2016
2022
2033
2039
2044
2050
2061
2067
2072
2078
2089
2095
2101
2107
2112
2118</pre>
 
=={{header|Delphi}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.