Day of the week of Christmas and New Year: Difference between revisions
Day of the week of Christmas and New Year (view source)
Revision as of 08:49, 29 November 2021
, 2 years ago→{{header|Ring}}: removed external library dependency, removed hard-coded date, this routine will now automatically work every year without having to modify it
(→{{header|Ring}}: removed external library dependency, removed hard-coded date, this routine will now automatically work every year without having to modify it) |
|||
Line 196:
=={{header|Ring}}==
<lang ring>? "working..."
weekdays = ["Mon","Tues","Wednes","Thurs","Fri","Satur","Sun"]
dow = timelist()[15]
today = date()
tycd = "25/12/" + substr(today, 7, 4)
nnyd = "01/01/" + string(number(substr(today, 7, 4)) + 1)
for day = 0 to 366
anotherday = adddays(today, day)
if anotherday = tycd
ok
if anotherday = nnyd
? "The next New Year's day is on a " + nameof(day) + "."
exit
ok
next
func nameof day
return weekdays[((day + today - 1) % 7) + 1] + "day"</lang>
▲see "This year's Christmas is on a " + weekdays[d1] + nl
▲see "done..." + nl
{{out}}
<pre>working...
done...</pre>▼
▲Next new year is on a Saturday
▲done...
=={{header|Wren}}==
|