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}} |
|||
⚫ | |||
Using the ActiveSupport library for some convenience methods |
|||
⚫ | |||
def last_friday(year, month) |
def last_friday(year, month) |
||
d = Date.new(year, month, 1) |
d = Date.new(year, month, -1) |
||
d = d.prev_day until d.friday? |
|||
d = d.yesterday |
|||
end |
|||
d |
d |
||
end |
end |
||
</lang> |
|||
=={{header|Run BASIC}}== |
=={{header|Run BASIC}}== |