Jump to content

Find the last Sunday of each month: Difference between revisions

tighter code
(Added Rebol code)
(tighter code)
Line 1,097:
year [integer!] "which year?"
][
d: to-date reduce [1 1 year] ; start with first day of year
collect [
repeat month 12 [
d/month: to-datemonth reduce+ [1 month year] ; move to start of next month
keep sundayd - d/weekday ; calculate last sunday of& monthkeep
until [
if d/weekday = 7 [sunday: d]
d: d + 1
d/month != month
]
keep sunday ; last sunday of month
]
]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.