Last Friday of each month: Difference between revisions

Content added Content deleted
m (→‎{{header|REXX}}: changed/added comments and whitespace, changed indentations, moved documentation for the lastDOW function to a separate window.)
(→‎{{header|Ruby}}: Replaced active_support version, date class recently got its own convenience methods.)
Line 2,133: Line 2,133:
</pre>
</pre>


Or get the last day of the month and go to the previous day until it's friday.
{{libheader|ActiveSupport}}
<lang ruby>require 'date'
Using the ActiveSupport library for some convenience methods

<lang ruby>require 'activesupport'


def last_friday(year, month)
def last_friday(year, month)
d = Date.new(year, month, 1).end_of_month
d = Date.new(year, month, -1)
until d.wday == 5
d = d.prev_day until d.friday?
d = d.yesterday
end
d
d
end</lang>
end
</lang>


=={{header|Run BASIC}}==
=={{header|Run BASIC}}==