CALENDAR Day of week, future date, past date, and number of days calculations. ----begin documentation---- Program: CALENDAR Author: John P. Powers (jpp@cpdvax.csc.ti.com) Date: November 5, 1992 This program calculates day of week, the number of days between two dates, and a past or future date. Execute CALENDAR to begin the main program. A menu is then displayed: [ CMP | DATE1 | DATE2 | -DAYS | QUIT ] Enter an early date into DATE1 and a later date into DATE2. To enter a date press or . The calculator then prompts for a date. Type in the date in the MM.DDYYYY format. For example, to enter November 5, 1992, type 11.051992. To calculate the number days between two dates, enter DATE1 and DATE2, then press [CMP] [-DAYS]. To calculate a future date, enter DATE1 and the number of days. Press to enter the number of days. The calculator then prompts for the number of days. Then press [CMP] [DATE2]. The future date is displayed in the format MM.DDYYYY and the day of the week is displayed. To calculate a date in the past, enter DATE2 and the number of days, then press [CMP] [DATE1]. The past date and day of the week is displayed. This program uses ACM algorithm 199. ----end documentation---- ----begin ascii---- \START\ \COMMENT=Program file dated 11/05/92, 11:05 \NAME=CALENDAR \FILE=calendar.85P Lbl ENTER Menu(1,"CMP",CMP,2,"DATE1",ED1,3,"DATE2",ED2,4,"\UC-Delta\DAYS",E\UC-Delta\\#\ D,5,"QUIT",QUIT) Lbl ED1 CALenter:D\->\D1 D\->\W:CALday Goto ENTER Lbl ED2 CALenter:D\->\D2 D\->\W:CALday Goto ENTER Lbl E\UC-Delta\D Input "\UC-Delta\Days: ",\UC-Delta\D Goto ENTER Lbl CMP Menu(1,"ENTER",ENTER,2,"DATE1",CD1,3,"DATE2",CD2,4,"\UC-Delta\DAYS",C\UC-Delta\\#\ D,5,"QUIT",QUIT) Lbl CD1 D2-\UC-Delta\D\->\D:D\->\D1 CALsplit Goto ENTER Lbl CD2 D1+\UC-Delta\D\->\D:D\->\D2 CALsplit Goto ENTER Lbl C\UC-Delta\D D2-D1\->\\UC-Delta\D Fix 0 Disp \UC-Delta\D Goto ENTER Lbl QUIT \STOP\ \START\ \COMMENT=Program file dated 11/05/92, 11:05 \NAME=CALday \FILE=calday.85P mod(W,7)\->\W If W==3:Disp "Sunday" If W==4:Disp "Monday" If W==5:Disp "Tuesday" If W==6:Disp "Wednesday" If W==0:Disp "Thursday" If W==1:Disp "Friday" If W==2:Disp "Saturday" \STOP\ \START\ \COMMENT=Program file dated 11/05/92, 11:05 \NAME=CALenter \FILE=calenter.85P Input "Date: ",FD iPart FD\->\MM iPart (100fPart FD)\->\DD \E\4fPart 100FD\->\YY If MM>2:Then MM-3\->\MM Else MM+9\->\MM YY-1\->\YY End iPart (YY/100)\->\C YY-100C\->\YY iPart (146097C/4)+iPart (1461YY/4)+iPart ((153MM+2)/5)+DD-578041\->\D \STOP\ \START\ \COMMENT=Program file dated 11/05/92, 11:05 \NAME=CALsplit \FILE=calsplit.85P D\->\W 578041+D\->\D iPart ((4D-1)/146097)\->\YY 4D-1-146097YY\->\D iPart (D/4)\->\DD iPart ((4DD+3)/1461)\->\D 4DD+3-1461D\->\DD iPart ((DD+4)/4)\->\DD iPart ((5DD-3)/153)\->\MM 5DD-3-153MM\->\DD iPart ((DD+5)/5)\->\DD 100YY+D\->\YY If MM<10:Then MM+3\->\MM Else MM-9\->\MM YY+1\->\YY End (YY/\E\4+DD)/\E\2+MM\->\D Fix 6 Disp D CALday \STOP\ ----end ascii---- ----begin uue---- begin 644 calendar.85g M*BI423@U*BH:#`!'!%3E1%4@!O3!!$,0`O+4-- M4``O-4--4"]$,@`O+41!5$4Q`"\U140Q+T0S`"\M1$%413(`+S5%1#(O1#0` M+RV^1$%94P`O-46^1"]$-0`O+5%5250`+S9154E4$6_@140Q`&\Z0T%,96YT M97)N,T0+-$0Q;S-$"S-7;CA#04QD87EOX0`&14Y415(`;^!%1#(`;SI#04QE M;G1E6_A``9%3E1%4@!OX$6^1`!OYBV^ M1&%Y90`D@`5$#-7 M+T0W`!$+,U=OV#-74$0S`&[I+5-U;F1A>0!OV#-74$0T`&[I+4UO;F1A>0!O MV#-74$0U`&[I+51U97-D87D`;]@S5U!$-@!NZ2U7961N97-D87D`;]@S5U!$ M,`!NZ2U4:'5R0!OV#-74$0Q`&[I+49R:61A>0!OV#-74$0R`&[I+5-A M='5R9&%Y``P`UP`2"$-!3&5N=&5RUP#5`.8M1&%T93H@`"\T1D1OHS1&1`LT M34UOHQ!$,3`P`*0T1D01"S1$1&]$&S0`I$0Q,#``-$9$"S1966_8-$U-4D0R M`&[9;S1-36%$,P`+-$U-;]IO-$U-8$0Y``LT34UO-%E9840Q``LT65EOWF^C M$#1967%$,3`P`!$+,T-O-%E9840Q,#``,T,+-%E9;Z,01#$T-C`Y-P`S0W%$ M-``18*,01#$T-C$`-%E9<40T`!%@HQ`01#$U,P`T34U@1#(`$7%$-0`18#1$ M1&%$-3