Day of the week: Difference between revisions
Content added Content deleted
(→{{header|D}}: D2's standard library is still changing) |
|||
Line 415: | Line 415: | ||
=={{header|D}}== |
=={{header|D}}== |
||
{{works with|D|2}} |
|||
<lang d>import std.stdio, std. |
<lang d>import std.stdio, std.datetime, std.conv; |
||
void main() { |
void main() { |
||
foreach (year; 2008 .. 2122) |
|||
if (0 == |
if (0 == Date.fromSimpleString(to!string(year) ~ "-Dec-25").dayOfWeek()) { |
||
writefln("Christmas comes on a sunday in %d", year); |
writefln("Christmas comes on a sunday in %d", year); |
||
} |
|||
}</lang> |
}</lang> |
||