This program is Copyright © 1976 by HewlettPackard and is used here by permission. This program was originally published in the HP67 Standard Pac.
This program is supplied without representation or warranty of any kind. HewlettPackard Company and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
Calendar Functions 

Shift 





Label 
<>DT1 
<>DT2 
<>#Days 
<>#Wks.Dys 
DT>DOW 
Key 
A 
B 
C 
D 
E 
For the period March 1, 1900 through February 28, 2100, this program interchangeably solves for dates and days. Given two dates, the number of days between them can be calculated. Given one date and a specified number of days, a second date can be found. The program will also work in terms of weeks between dates or compute the day of the week given the date. After input of a date, its Julian Day number* is displayed.
A date must be input in mm.ddyyyy format. For instance, June 3, 1975 is keyed in as 6.031975. It is important that the zero between the decimal point and the day of the month be included when the day of the month is less than 10. Weeks are input and output as WKS.DYS. Seven weeks, three days would be 7.3. The day of the week is represented by the digits 0through 6 where zero is Sunday.
To compute the day number from the date:
Julian Day number = INT(365.25y') + INT(30.6001 m') + d + 1,720,982 where year1 if m = 1 or 2 y' = or year if m > 2 month+13 if m=1 or 2 m' = or month+1 if m > 2
Then days between dates is found by
Days = Day number_{2}  Day number_{1}
To compute the date from a day number:
Day # = Julian Day Number  1,720,982 Y' = INT[(Day #  122.1)/365.25)]
*The Julian Day number is an astronomical convention representing the number of days since January 1, 4713 B.C.
m' = INT[(Day #  INT(365.25 y'))/30.6001] Day of the month = Day #  INT [365.25 y']  INT [30.6001 m'] m'  13 if m' = 14 or 15 Month = m = or m'  1 if m' < 14 y' if m > 2 year = or y' + 1 if m = 1 or 2
To compute the day of the week:
Day of the week = 7 x FRAC [(Day # + 5)/7]
No checking is done to determine if input data represents valid dates.
In this program the calculator uses flag 3 to decide what to do after A, B, C or D is pressed. If the numeric keys have been pressed, flag 3 is on. This causes the value in the display to be stored as an input when the userdefinable key is pressed. If no numeric keys have been touched, the program will calculate the value associated with the userdefinable key. Thus, it is important not to touch the numeric keys between the last input and the attempt to calculate a result.
Registers R0R2, RB, RD, RE and RS0RS9 are available for user storage.
Step 
Instructions 
Input Data/Units 
Keys 
Output Data/Units 
1 
Load side 1 and side 2. 

2 
For day of the week calculations go to step 6. 



3 
Input two of the following: 




First date (mm.ddyyyy) 
DT1 
A 
Day #1 

Second date (mm.ddyyyy) 
DT2 
B 
Day #2 

Days between dates 
Days 
C 
Days 

or weeks between dates* 
Wks.Dys 
D 
Days 
4 
Calculate one of the following: 




First date 

A 
Day #1 

Second date 

B 
Day #2 

Days between dates 

C 
Days 

Weeks between dates 

D 
Wks.Dys 
5 
For a new case go to step 2. 



6 
Input date and calculate day of the week (0 = Sunday, 6 = Saturday). 
DT 
E 
DOW 
7 
For a new case go to step 2. 




*Either days between dates or weeks between dates, but not both, may be input in step 3. 



Senior Lieutenant Yuri Gagarin flew Vostok I into space on April 12, 1961. On July 21, 1969 Neil Armstrong set foot on the moon. How many days had passed between the first manned space flight and the moon landing? How many weeks and days? On what day of the week did each event take place?
Keystrokes Outputs 4.121961 A 7.211969 B C 3022. (days) D 431.5 (weeks.days) 4.121961 E 3. (Wednesday) 7.211969 E 1. (Monday)
A short term note is due in 200 days. If the issue date is June 11, 1976, what is the maturity date? (Some securities use a 30/360 day calendar while this program performs all calculations using the actual number of days. Do not use the program for financial purposes unless you are sure that actual calendar days are correct.)
Keystrokes Outputs 6.111976 A 200 C B 12.281976 (December 28, 1976)
LINE KEYS 001 *LBL A Calculate days and put control 3 in display. 002 RCL 4 003 RCL C 004  005 3 006 GTO 0 007 *LBL B Calculate days and put control 4 in display. 008 RCL 3 009 RCL C 010 + 011 4 012 *LBL 0 Store control code. 013 STO I 014 roll dn Store constants. 015 3 016 6 017 5 018 . 019 2 020 5 021 STO 5 022 3 023 0 024 . 025 6 026 0 027 0 028 1 029 STO 6 030 roll dn Return days to display. 031 roll dn 032 F3? If data input, GTO 1. 033 GTO 1 034 STO (i) Store days according to control code. 035 1 036 2 037 2 Calculate y'. 038 . 039 1 040  041 RCL 5 042 ÷ 043 INT 044 STO 9 Calculate m'. 045 RCL 5 046 x 047 INT 048 RCL (i) 049  050 CHS 051 STO A 052 RCL 6 053 ÷ 054 INT 055 STO 7 Calculate day of the month. 056 RCL A 057 X<>Y 058 RCL 6 059 x 060 INT 061  062 STO 8 063 RCL 7 Build (m'1).dd part of display. 064 1 065 RCL 8 066 % 067  068  069 RCL 7 Correct m' 1 and y' to m and y. 070 1 071 4 072 ÷ 073 GSB 2 074 RCL 9 Finish building mmm.ddyyyy result and display 075 EEX final answer. 076 6 077 ÷ 078 + 079 DSP 6 080 RTN 081 *LBL 1 Break date input into the individual components of mm, dd, yyyy. 082 roll dn 083 ENTER 084 INT 085 STO 7 086  087 EEX 088 2 089 x 090 ENTER 091 INT 092 STO 8 093  094 EEX 095 4 096 x 097 STO 9 098 RCL 7 m + 1 099 1 100 + 101 ENTER 102 1/X 103 . m + 1 > m' 104 7 105 + y > y' 106 CHS 107 GSB 2 108 RCL 6 Compute day number. 109 x 110 INT 111 RCL 9 112 RCL 5 113 x 114 INT 115 + 116 RCL 8 117 + 118 STO (i) 119 1 Compute julian day number for output. 120 7 121 2 122 0 123 9 124 8 125 2 126 + 127 DSP 0 128 RTN 129 *LBL 2 If input to this routine has absolute value 1 or greater: 130 INT y = y +/ 1 131 STO + 9 m = m +/ 12 132 1 133 2 134 x 135  (+ for plus input) 136 RTN 137 *LBL C Store input. 138 DSP 0 139 STO C 140 F3? If input flag, stop. 141 RTN 142 RCL 4 143 RCL 3 Calculate days and stop. 144  145 STO C 146 RTN 147 *LBL D If input GTO 4. 148 F3? 149 GTO 4 150 GSB C 151 DSP 1 Compute days. 152 *LBL 3 153 7 Convert to weeks.days format. 154 ÷ 155 INT 156 LST X 157 FRAC 158 . 159 7 160 x 161 + 162 RTN 163 *LBL 4 164 DSP 0 Convert weeks.days to days and store. 165 ENTER 166 INT 167 7 168 x 169 X<>Y 170 FRAC 171 1 172 0 173 x 174 + 175 STO C 176 RTN 177 *LBL E Calculate day number. 178 SF 3 179 RCL 5 180 5 181 GSB 0 182 RCL (i) Change day number to modulo 7 number. 183 5 184 + 185 GSB 3 186 LST X 187 1 188 0 189 x 190 RTN 191 R/S
R3 Day #1 R4 Day #2 R5 365.25 R6 30.6001 R7 m R8 d R9 y A used C days I control
Go back to the software library
Go back to the main exhibit hall