'function parameters: YEAR, MONTH, DAY
Today$ = GETDAYNAME(2019, 12, 28)
PRINT "Today is "; Today$
PRINT "Today is also "; GetDay
(12, 28, 2019)
FUNCTION GETDAYNAME$
(year
, month
, day
) 'otestovano brutalne, fuguje skutecne spravne! 'spocitat pocet mesicu od ledna 1900:
Days = day
IF yyr
= year
THEN monthend
= month
ELSE monthend
= 12 Om = m
Days = Days + m
Days = Days - m - 1
' PRINT "Dnu:"; Days
a
= (Days
MOD 7) '0 = pondeli nms:
DATA Monday
,Tuesday
,Wednesday
,Thursday
,Friday
,Saturday
,Sunday
FUNCTION GetDay$
(mm
, dd
, yyyy
) 'use 4 digit year 'From Zeller's congruence: https://en.wikipedia.org/wiki/Zeller%27s_congruence
IF mm
< 3 THEN mm
= mm
+ 12: yyyy
= yyyy
- 1 zerocentury = yyyy \ 100
result
= (dd
+ INT(13 * (mm
+ 1) / 5) + century
+ INT(century
/ 4) + INT(zerocentury
/ 4) + 5 * zerocentury
) MOD 7 CASE 0: GetDay$
= "Saturday" CASE 1: GetDay$
= "Sunday" CASE 2: GetDay$
= "Monday" CASE 3: GetDay$
= "Tuesday" CASE 4: GetDay$
= "Wednesday" CASE 5: GetDay$
= "Thursday" CASE 6: GetDay$
= "Friday"