Day of the week: Difference between revisions
Content added Content deleted
m (→{{header|UNIX Shell}}: I just wanted to mark it incorrect until the dates were fixed) |
(added ruby) |
||
Line 268: | Line 268: | ||
25 Dec 2118</pre> |
25 Dec 2118</pre> |
||
=={{header|Ruby}}== |
|||
<ruby>require 'date' |
|||
SUNDAY = 0 |
|||
for year in 2008..2121 |
|||
day = Date.new(year, 12, 25) |
|||
if day.wday == SUNDAY |
|||
puts '12 Dec %d' % year |
|||
end |
|||
end</ruby> |
|||
Output: |
|||
<pre>25 Dec 2011 |
|||
25 Dec 2016 |
|||
25 Dec 2022 |
|||
25 Dec 2033 |
|||
25 Dec 2039 |
|||
25 Dec 2044 |
|||
25 Dec 2050 |
|||
25 Dec 2061 |
|||
25 Dec 2067 |
|||
25 Dec 2072 |
|||
25 Dec 2078 |
|||
25 Dec 2089 |
|||
25 Dec 2095 |
|||
25 Dec 2101 |
|||
25 Dec 2107 |
|||
25 Dec 2112 |
|||
25 Dec 2118</pre> |
|||
=={{header|UNIX Shell}}== |
=={{header|UNIX Shell}}== |