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
Day of week is automatic in menu
Day of week is automatic in menu
Last edited by schristis on Sat Feb 24, 2024 8:51 pm, edited 1 time in total.
Re: Day of week is automatic in menu
Gets day of week from DA$
- desertfish
- Posts: 1096
- Joined: Tue Aug 25, 2020 8:27 pm
- Location: Netherlands
Re: Day of week is automatic in menu
The clock_get_date_time kernal routine actually returns the day of the week , but this doesn't seem exposed in Basic...
Re: Day of week is automatic in menu
I'm talking about how the "weekday" can be set incorrectly
to the "dateseting" in the menu controll pannel... its independant...
you can actually say its Wednsday when its Saturday with the correct date..
and can actually fix that issue..
But it probably doesn't worry any1...
I don't know why the weekday is actually stored in menu control panel...
I just know you can set it in MENU ..... like its SATYRDAY SUNDAY OR MONDAY...
but it probably doesn't matter too much...
But I I just make things up as I go along... and I may not know what I'm talking about...
Its just that the weekday can be set wrongly, to todays date....
to the "dateseting" in the menu controll pannel... its independant...
you can actually say its Wednsday when its Saturday with the correct date..
and can actually fix that issue..
But it probably doesn't worry any1...
I don't know why the weekday is actually stored in menu control panel...
I just know you can set it in MENU ..... like its SATYRDAY SUNDAY OR MONDAY...
but it probably doesn't matter too much...
But I I just make things up as I go along... and I may not know what I'm talking about...
Its just that the weekday can be set wrongly, to todays date....
- Attachments
-
- weekday.jpg (44.21 KiB) Viewed 1666 times