This three-part program returns correct day name, changes Gregorian dates to corresponding Julian day numbers, and computes total days between any two dates from Jan. 1 AD to Feb. 2300.
To use, type the month number (NL), day number (NL), and four-digit year (NL). ZX80 returns the correct day name, followed by a prompt. Type J (NL) and it prints the equivalent Julian day number. (Julian days begin at GMT noon on each day and count days from noon, January 1, 4713 BC.)
You can also calculate the number of days between two dates. Enter the earlier one first, using J (NL) to compute JD, then enter the second date but just hit (NL) instead of J (NL) to request total days between the 2 dates.
Note that the ZX80 correctly reads out JD numbers in millions, thousand and units, but blanks leading zeros in each group. When reporting total days, sometimes the program displays thousands of days as 1000 too high, followed by negative hundreds; just add them. For example: A read out of 2,-825 means total days = 1,175.
To exit the program, enter numeral zero (NL) as the month.
Note: This program takes leap years into account, but as written cannot display them.–AZ
10 PRINT "COMPU-CAL"
15 CLEAR
20 PRINT "ENTER MO/DY/YEAR"
30 INPUT M
40 IF M=0 THEN STOP
50 INPUT D
55 INPUT Y
57 CLS
62 PRINT "YOUR DATE(";M;"/";D;"/";Y;")=";
68 IF Y<1900 OR (Y=1900 AND M<3) THEN LET D=D+1
69 IF Y<1800 OR (Y=1800 and M<3) THEN LET D=D+1
70 IF M>2 THEN GO TO 90
80 LET Y=Y-1
85 LET M=M+13
87 GO TO 91
90 LET M=M+1
91 IF Y>2199 THEN LET D=D-1
93 IF Y>2099 THEN LET D=D-1
100 LET A=Y*3+7200
110 LET B=(Y*6)+(M*3)+98
120 LET C=(Y*5)+((M*6)/10)
130 LET D=D+(Y/4)+C+2
135 LET L=1+A/10000
136 LET A=A-(10000*(A/10000))
145 LET T=(A/10)+(B/100)+(D/1000)
147 LET U=(100*(A-10*(A/10)))+(10*(B-(100*(B/100)))+(D-1000*(D/1000)))
148 LET T=T+U/1000
149 LET U=U-(1000*(U/1000))
150 LET Z=2+L+(T*-1)+U
155 LET Z=Z-(7*(Z/7))
157 IF Z<0 THEN LET Z=Z+7
158 GO SUB (Z*2)+160
159 GO TO 179
160 PRINT "SATUR";
161 RETURN
162 PRINT "SUN";
163 RETURN
164 PRINT "MON";
165 RETURN
166 PRINT "TUES";
167 RETURN
168 PRINT "WEDNES";
169 RETURN
170 PRINT "THURS";
171 RETURN
172 PRINT "FRI";
173 RETURN
174 GO TO 160
179 PRINT "DAY"
181 INPUT J$
182 IF J$="J" THEN GO TO 195
186 IF T-S<1 THEN GO TO 188
187 PRINT T-S;",";
188 PRINT U-W;" TOTAL DAYS"
190 GO TO 15
195 LET S=T
197 LET W=U
199 PRINT "JD=";L;",";T;",";U
210 GO TO 20
SYNTACTIC SUM = 22279
Media
Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.