Find the last Sunday of each month: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: used a template for the output section.) |
Drkameleon (talk | contribs) (obsolete) |
||
Line 535: | Line 535: | ||
2020-11-29 |
2020-11-29 |
||
2020-12-27"</pre> |
2020-12-27"</pre> |
||
=={{header|Arturo}}== |
|||
<lang arturo>lastSundayForMonth: @(m){ |
|||
if [contains #(1 3 5 7 8 10 12) m] -> nofDays: 31 |
|||
if [contains #(4 6 9 11) m] -> nofDays: 30 |
|||
if m=2 -> nofDays: 27 |
|||
loop nofDays..1 @(d){ |
|||
dt: datetime "2013-"+m+"-"+d "yyyy-M-dd" |
|||
if [day dt]="Sunday" -> return dt |
|||
} |
|||
} |
|||
loop 1..12 -> print [datetime [lastSundayForMonth &] "yyyy-MM-dd"]</lang> |
|||
{{out}} |
|||
<pre>2013-01-27 |
|||
2013-02-24 |
|||
2013-03-31 |
|||
2013-04-28 |
|||
2013-05-26 |
|||
2013-06-30 |
|||
2013-07-28 |
|||
2013-08-25 |
|||
2013-09-29 |
|||
2013-10-27 |
|||
2013-11-24 |
|||
2013-12-29</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |