Day of the week: Difference between revisions

(→‎{{header|C}}: remove time_t size limit)
Line 1,683:
 
(2008..2121).each do |year|
puts "25 Dec #{year}" if Date.new(year, 12, 25).wday == 0 # Ruby 1.9: if Date.new(year, 12, 25).sunday?
end</lang>
Output:
Line 1,712:
begin
day = Time.local(year, 12, 25)
puts "25 Dec #{year}" if day.wday == SUNDAY # Ruby 1.9: if day.sunday?
rescue ArgumentError
puts '%d is the last year we can specify' % (year-1)
Anonymous user