DAY$()

Compatible with:
DOS Maximite CMM MM150 MM170 MM+ MMX Picromite ArmiteL4 Armite F4 ArmiteH7 CMM2

Syntax:
DAY$(date$)

Description:
Returns the day of the week for a given date as a string “Monday”, “Tuesday” etc. 
The format for date$ is “dd-mm-yyyy”. 
Use NOW to get the day for the current date, e.g. ? DAY$(NOW)

If your system doesn't have DAY$(),

 today$ = "13-09-2020" 'date$
 PRINT today$
 PRINT dayX$(today$)
 PRINT DayL$(today$)
 
FUNCTION DayX$(dt$)
 LOCAL INTEGER d,m,y,jd,weekday
 d=VAL(MID$(dt$,1,2))
 m=VAL(MID$(dt$,4,2))
 y=VAL(MID$(dt$,7,4))
 IF m < 3 THEN m = m+12:y=y-1
 jd= d + FIX(365.25*(Y+4716)) + FIX(30.6001*(M+1)) - y\100 + y\400 + 4
 weekday = (jd MOD 7) + 1
 DayX$ = MID$("  MonTueWedThuFriSatSun",weekday*3,3)
END FUNCTION

FUNCTION DayL$(dt$)
 LOCAL INTEGER d,m,y,jd,weekday,k
 d=VAL(MID$(dt$,1,2))
 m=VAL(MID$(dt$,4,2))
 y=VAL(MID$(dt$,7,4))
 IF m < 3 THEN m = m+12:y=y-1
 jd= d + FIX(365.25*(Y+4716)) + FIX(30.6001*(M+1)) - y\100 + y\400 + 4
 weekday = (jd MOD 7) + 1
 DayL$ = MID$("        Monday   Tuesday  WednesdayThursday Friday   Saturday Sunday   ",weekday*9,9)
 k = INSTR(DayL$, " ")
 IF k > 1 THEN DayL$=LEFT$(DayL$,k-1)
END FUNCTION

Last edited: 29 September, 2020