Last Friday of each month: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: added/changed whitespace and comments, used a template for the output section.) |
m (→{{header|REXX}}: redid the boxed comments in the REXX preamble.) |
||
Line 3,226: | Line 3,226: | ||
<br>It wasn't optimized just to find a particular day-of-week. |
<br>It wasn't optimized just to find a particular day-of-week. |
||
The documentation for the '''lastDOW''' function (used in the REXX program below): |
The documentation for the '''lastDOW''' function (used in the REXX program below): |
||
╔════════════════════════════════════════════════════════════════════════════════════════════════╗ |
|||
╔════════════════════════════════════════════════════════════════════╗ |
|||
║ lastDOW: procedure to return the date of the last day─of─week of any particular month of any ║ |
|||
║ particular year. ║ |
|||
║ ║ |
|||
║ The day─of─week must be specified (it can be in any case, (lower─/mixed─/upper─case) as an ║ |
|||
⚫ | |||
║ (lower─/mixed─/upper─case) as an English name of the spelled day ║ |
|||
⚫ | |||
⚫ | |||
║ I.E.: TU for Tuesday. W for Wednesday, Sa for Saturday, Su for Sunday ... ║ |
|||
║ ║ |
|||
║ The month can be specified as an integer 1 ──► 12 ║ |
|||
║ 1=January 2=February 3=March 4=April 5=May 6=June ... 12=December ║ |
|||
║ or the English name of the month, with a minimum length that causes no ambiguity. ║ |
|||
║ I.E.: JA for January, AP for April, JUN for June, JUL for July, D for December.║ |
|||
║ If omitted [or an asterisk(*)], the current month is used. ║ |
|||
║ ║ |
|||
║ The year is specified as an integer or just the last two digits (two digit years are assumed ║ |
|||
║ to be in the current century, and there is no windowing for a two─digit year). If omitted ║ |
|||
║ [or an asterisk(*)], the current year is used. Years < 100 must be specified with (at ║ |
|||
║ least 2) leading zeroes. ║ |
|||
║ If omitted [or an asterisk(*)], the current year is used. ║ |
|||
║ ║ |
|||
║ Years < 100 must be specified with (at least 2) leading zeroes.║ |
|||
║ The method used is: find the "day number" of the 1st of the next month and then subtract one ║ |
|||
⚫ | |||
║ (this gives the "day number" of the last day of the month, bypassing the leapday mess). The ║ |
|||
⚫ | |||
║ then subtract one (this gives the "day number" of the last day of ║ |
|||
╚════════════════════════════════════════════════════════════════════════════════════════════════╝ |
|||
║ the month, bypassing the leapday mess). The last day─of─week is ║ |
|||
⚫ | |||
╚════════════════════════════════════════════════════════════════════╝ |
|||
<lang rexx>/*REXX program displays the dates of the last Fridays of each month for any given year.*/ |
<lang rexx>/*REXX program displays the dates of the last Fridays of each month for any given year.*/ |
||
parse arg yyyy /*obtain optional argument from the CL.*/ |
parse arg yyyy /*obtain optional argument from the CL.*/ |