I need to find the date for the last Sunday in January, for any year. I
need this for a budgetary script I’m trying to write. Using the
Date/Time module, I’ve done this so far.
now = DateTime.now
year = now.year
d = Date.new(now.year, 1, 31)
This tells me that the last day of January is a Wednesday. But, I need
that last Sunday. Is there a method in ‘date’ that can give me the date
of the last Sunday? The last Sundays of each month are the boundaries
for my company’s budget periods.