Day of week is automatic in menu
Posted: Sat Feb 24, 2024 12:17 pm
Just that the day of week to be automatic from the date setting...
I have managed to work out how to find the day of the week using Zeller's Congruence formula without having the MOD function on the X16... it was a little complicated to figure out...
If you could extract the formula out of the basic program I made to use in the ROM Kernal so the day of the week is automatic would be a good feature...
But it probably does't matter either.... I know....
Its probably just as easy to type the day of the week in the menu setting, rather than a formula take up ROM space...
But the formula is in this basic program if anyone wants to use it...
just thought I'd post it...
Best regards
Shaun 10 REM ******************CALCULATE WEEKDAY*************
12 REM GET DATE FROM DA$
14 YO$=MID$(DA$,1,4):DO$=MID$(DA$,7,2):GG$=MID$(DA$,5,2)
15 Y=VAL(YO$):M=VAL(GG$):D=VAL(DO$)
18 IF M<3 THEN M=M+12:Y=Y-1:REM Y IS YEAR,M IS MONTH, Y IS YEAR
22 K=Y-INT(Y/100)*100
24 J=INT(Y/100)
26 H=D+INT(13*(M+1)/5)+K+INT(K/4)+INT(J/4)-2*J:REM CALCULATE THE MODULO 7
28 H=H-7*INT(H/7):REM 'H' IS THE DAY OF THE WEEK FROM 1 TO 7
30 IF H=0 THEN H=7
32 ON H GOTO 41, 42, 43, 44, 45, 46, 47
34 PRINT "TODAY IS "DY$
36 END
41 DY$="SUN":GOTO 34
42 DY$="MON":GOTO 34
43 DY$="TUE":GOTO 34
44 DY$="WED":GOTO 34
45 DY$="THU":GOTO 34
46 DY$="FRI":GOTO 34
47 DY$="SAT":GOTO 34
I have managed to work out how to find the day of the week using Zeller's Congruence formula without having the MOD function on the X16... it was a little complicated to figure out...
If you could extract the formula out of the basic program I made to use in the ROM Kernal so the day of the week is automatic would be a good feature...
But it probably does't matter either.... I know....
Its probably just as easy to type the day of the week in the menu setting, rather than a formula take up ROM space...
But the formula is in this basic program if anyone wants to use it...
just thought I'd post it...
Best regards
Shaun 10 REM ******************CALCULATE WEEKDAY*************
12 REM GET DATE FROM DA$
14 YO$=MID$(DA$,1,4):DO$=MID$(DA$,7,2):GG$=MID$(DA$,5,2)
15 Y=VAL(YO$):M=VAL(GG$):D=VAL(DO$)
18 IF M<3 THEN M=M+12:Y=Y-1:REM Y IS YEAR,M IS MONTH, Y IS YEAR
22 K=Y-INT(Y/100)*100
24 J=INT(Y/100)
26 H=D+INT(13*(M+1)/5)+K+INT(K/4)+INT(J/4)-2*J:REM CALCULATE THE MODULO 7
28 H=H-7*INT(H/7):REM 'H' IS THE DAY OF THE WEEK FROM 1 TO 7
30 IF H=0 THEN H=7
32 ON H GOTO 41, 42, 43, 44, 45, 46, 47
34 PRINT "TODAY IS "DY$
36 END
41 DY$="SUN":GOTO 34
42 DY$="MON":GOTO 34
43 DY$="TUE":GOTO 34
44 DY$="WED":GOTO 34
45 DY$="THU":GOTO 34
46 DY$="FRI":GOTO 34
47 DY$="SAT":GOTO 34