(11C) Calendar Routines - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Software Libraries (/forum-10.html) +--- Forum: General Software Library (/forum-13.html) +--- Thread: (11C) Calendar Routines (/thread-14311.html) (11C) Calendar Routines - Gamo - 01-04-2020 10:30 AM HP-11C Solutions Handbook doesn't provide the Calendar Routines. Found that HP-55 Mathematic programs got the "Calendar Routines" program so I adapted this program to work for HP-11C For those who have HP-55 Mathematic Program book this routine is on page 75 As stated in this book: This program called March 1, 1700, day 1 and gives every succeeding day a corresponding number. The program works for days to and including February 28, 2100. However, for days from March 1, 1700, to Febuary 28, 1800, 2 days must be added to tha answer and for days from March 1, 1800, to February 18, 1900, 1 day must be added. ------------------------------------------------------------------ Procedure: [USER] [FIX] 0 [A] Month // 1 for January [B] Day // 1 to 31 [C] Year // 2020 [D] Day of the Week // 0 = Sunday [E] Days Between Two Dates // 1st Date start Label [D] 2nd Date [E] ------------------------------------------------------------------ Example: What day of the week for 1/4/2020 1 [A] display 1 4 [B] display 4 2020 [C] display 2020 [D] display 6 // Answer is Saturday ---------------------------------------- Dates from previous problem how many days to 1/31/2020 Month and Year is the same only change the day to 31 31 [B] display 31 [E] display 27 // Answer: 27 days --------------------------------------- Program: Code: ``` LBL A  // Month STO 1 RTN --------- LBL B  // Day STO 2 RTN --------- LBL C  // Year STO 3 RTN --------------- LBL D // Day of the Week GSB 0 STO 4 7 ÷ ENTER INT - 7 x RTN -------------- LBL E // Days between Two Dates GSB 0 RCL 4 - RTN -------------- LBL 0 // Calendar Routines 2 RCL 1 X≤Y GTO 1 1 + RCL 3 GTO 2 ------------- LBL 1 13 + RCL 3 1 - ------------- LBL 2 365.25 x ENTER INT X<>Y Rv X<>Y 30.6 x ENTER INT X<>Y Rv + RCL 2 + 621049 - RTN``` Gamo 1/4/2020 RE: (11C) Calendar Routines - Gamo - 05-25-2021 11:27 AM Here is another Calendar routine to find "Number of Weekdays Between Two Dates" and find the "Date" form the mm/dd/yyyy at which result 0 is Sunday 1 is Monday and so on. This program is from the HP-67 adapted to work on the HP-11C Sample Problem Apr. 1, 1974 and May 1, 1974 4.011974 [A] 5.011974 [A] ——— 22.0 ------------------------------------------------- Find the Date on Jan. 1, 1960 1.011960 [A] [B] ——— 5 (Friday) ------------------------------------------------- Program: Code: ``` [LBL] A 9 [ENTER] [EEX] 6 [CHS] [-] [X<>Y] 3 [X<>Y] [X≤Y] [GSB] 1 1 [+] [ENTER] [INT] [STO] 1 [-] [EEX] 2 [x] [ENTER] [FRC] [EEX] 2 [x] [ENTER] [INT] 7 [-] .75 [x] [INT] [X<>Y] 36525 [x] [INT] [-] [-] [INT]  [RCL] 1 30.6 [x] [INT] [+] 7 [÷] [ENTER] [FRC] [-] [LSTx] [STO] 3 12.61 [x] [INT] .1 [x] [+] 5 [x] [RCL] 2 [X<>Y] [STO] 2 [-] [CHS] [FIX] 1 [RTN] [LBL] B [RCL] 3 7 [x] [FIX] 0 [RTN] [LBL] 1 [+] [+] [RTN] [R/S]``` Gamo