Find the last Sunday of each month: Difference between revisions
Find the last Sunday of each month (view source)
Revision as of 22:25, 6 October 2013
, 10 years ago→{{header|Ruby}}
Line 814:
def last_sundays_of_year(year = Date.today.year)
(1..12).map do |month|
d = Date.new(year, month, -1) # -1 means "last".
d -= 1 until d.sunday?
d
|