10 '******************** 20 ' Day-Date Program 30 ' by Dirk Tjossem 40 'copyright1982 Artsci 50 '******************** 60 GOSUB 620 70 CLS 80 PRINT "DAYS BETWEEN TWO" 90 PRINT "DATES" 100 LPRINT "DAYS BETWEEN TWO" 110 LPRINT "DATES" 120 PRINT: LPRINT 130 PRINT "First Date (m/d/y)" 140 GOSUB 680 150 M=DT(1): D=DT(2): Y=DT(3) 160 GOSUB 320: IF ER THEN 130 170 LPRINT IN$ 180 GOSUB 530: A1=A 190 PRINT "Second Date (m/d/y)" 200 GOSUB 680 210 M=DT(1): D=DT(2): Y=DT(3) 220 GOSUB 320: IF ER THEN 190 230 LPRINT IN$ 240 GOSUB 530 250 N=ABS(A-A1) 260 PRINT "Difference=";N;"DAYS" 270 LPRINT "Difference=";N;"DAYS" 280 PRINT 290 INPUT "More (Y/N)";X$ 300 IF LEFT$(X$,1)="Y" OR LEFT$(X$,1)="y" THEN CLS: LPRINT: GOTO 130 310 END 320 ER=0 330 ON M GOTO 360,380,360,440,360,440,360,360,440,360,440,360 340 PRINT "UNREAL DATE": ER=-1 350 RETURN 360 IF D>31 THEN 340 370 GOTO 450 380 IF Y/4<>INT(Y/4) THEN 410 390 IF Y/400=INT(Y/400) THEN 420 400 IF Y/100<>INT(Y/100) THEN 420 410 IF D>28 THEN 340 420 IF D>29 THEN 340 430 GOTO 450 440 IF D>30 THEN 340 450 A=DM%(M-1) 460 A=A+Y*365+INT(Y/4)+D+1-INT(Y/100)+INT(Y/400) 470 IF INT(Y/4)<>Y/4 THEN 520 480 IF Y/400=INT(Y/400) THEN 500 490 IF Y/100=INT(Y/100) THEN 510 500 IF M>2 THEN 520 510 A=A-1 520 RETURN 530 REM*** "DAY OF THE WEEK" 540 PRINT 550 IF M>2 THEN 570 560 M=M+12: Y=Y-1 570 N=D+2*M+INT(.6*(M+1))+Y+INT(Y/4)-INT(Y/100)+INT(Y/400)+2 580 N=N MOD 7 590 PRINT DOW$(N) 600 LPRINT DOW$(N) 610 RETURN 620 DIM DOW$(6), DM%(11) 630 DATA "Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday" 640 DATA 0,31,59,90,120,151,181,212,243,273,304,334 650 FOR N=0 TO 6: READ DOW$(N): NEXT 660 FOR N=0 TO 11: READ DM%(N): NEXT 670 RETURN 680 IN$="" 690 X$=INKEY$ 700 IN$=IN$+X$ 710 PRINT X$; 720 IF X$<>CHR$(13) THEN 690 730 N=0 740 FOR I=1 TO 3 750 GOSUB 790 760 DT(I)=NB 770 NEXT 780 RETURN 790 NB=0 800 N=N+1 810 IF N>LEN(IN$) THEN PRINT "ERROR" 820 X$=MID$(IN$,N,1) 830 IF ASC (X$)=>ASC("0") AND ASC(X$)<=ASC("9") THEN NB=NB*10+VAL(X$): GOTO 800 840 IF NB=0 THEN GOTO 800 ELSE RETURN