HP Forums
(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