01-03-2020, 04:11 PM

These programs are mostly adapted from the HP-67 Standard Pac calendar functions card SD-04A (or at least the algorithms are; the program code is quite different). You will need to use two cards, or write to both sides of a single card, which seems to work fine.

Recommended key labels:

Card 1

A: ΔDAYS

B: DT→D#

C: DT→DOW

D: D#→DOW

Card 2

A: D#→DT

B: ΔD→ΔW.D

Calculations are accurate for dates between Mar. 1, 1900 through Feb. 28, 2100. Some limited calculations outside this range can be done accurately, but the program incorrectly treats all years divisible by 100 as leap years, whereas years divisible by 100 but not divisible by 400 are not leap years. Day-of-week calculations will be incorrect outside the supported date range.

Usage

All dates are entered in MM.DDYYYY format. You may ignore any instructions to load a card if that card is currently already loaded.

Calculate the number of days between two dates

Load card 1. Enter the earlier date, press ENTER, enter the later date, and press A. The number of days will be returned in X.

Example:

How many days remaining until the 2020 US elections?

1.032020 ENTER

11.032020 A: 305

Calculate a day number for a given date

Load card 1. Enter the date into X, and press B. The day number will be returned in X. The value in the Y register will be preserved.

Example:

What is the day number of the 2020 summer solstice in the northern hemisphere?

6.202020 B: 738039

These day numbers can be used with card 2 to calculate future/past dates relative to a starting date. If you wish to convert the day numbers used by this program to Julian day numbers, simply add 1720982.

Calculate the day of the week for a given date

Load card 1. Enter the date into X, and press C. The day of the week will be returned in X. Sunday is 0, Monday is 1, proceeding through Saturday, which is 6.

Example:

What day of the week is the 2020 vernal equinox in the northern hemisphere?

3.192020 C: 4 (Thursday)

Calculate the day of the week for a given day number

Load card 1. With the day number in X (e.g. after computing a day number by pressing B), press D to calculate the day of the week. Output is the same as converting a date to the day of the week.

Calculate the date a given number of days before/after a starting date

Load card 1. Enter the starting date into X, and press B to compute the day number. Optional: save this day number in R7 or R8 if you intend to do multiple calculations with the same starting date.

Load card 2. Perform addition/subtraction on the day number in X. Optional: save the new day number in R7 or R8 if you wish to calculate multiple intervals. Press A and the new day number in X will be converted to a date in MM.DDYYYY format and returned in X. If you saved a day number in R7 or R8, you may recall the number and perform additional calculations/conversions.

Example:

What will be the date 57 days from now? 90 days from now?

Load card 1.

1.032020 B: 737870

STO 7

Load card 2.

57 +: 737927

A: 2.292020 Feb. 29, 2020 (Note: you may need to press DSP . 6 to see the full date.)

RCL 7: 737870

90 +: 737960

A: 4.022020 Apr. 2, 2020

Calculate the number of weeks + days between two dates

Load card 1. Enter the earlier date, press ENTER, and enter the later date. Press A to calculate the number of days between the two dates. Load card 2. Press B to convert the number of days to number of weeks + days in W.D format.

Example:

How many weeks + days until June 1st?

Load card 1.

1.032020 ENTER

6.012020 A: 150

Load card 2.

B: 21.3 (21 weeks and 3 days)

Program Code

Recommended key labels:

Card 1

A: ΔDAYS

B: DT→D#

C: DT→DOW

D: D#→DOW

Card 2

A: D#→DT

B: ΔD→ΔW.D

Calculations are accurate for dates between Mar. 1, 1900 through Feb. 28, 2100. Some limited calculations outside this range can be done accurately, but the program incorrectly treats all years divisible by 100 as leap years, whereas years divisible by 100 but not divisible by 400 are not leap years. Day-of-week calculations will be incorrect outside the supported date range.

Usage

All dates are entered in MM.DDYYYY format. You may ignore any instructions to load a card if that card is currently already loaded.

Calculate the number of days between two dates

Load card 1. Enter the earlier date, press ENTER, enter the later date, and press A. The number of days will be returned in X.

Example:

How many days remaining until the 2020 US elections?

1.032020 ENTER

11.032020 A: 305

Calculate a day number for a given date

Load card 1. Enter the date into X, and press B. The day number will be returned in X. The value in the Y register will be preserved.

Example:

What is the day number of the 2020 summer solstice in the northern hemisphere?

6.202020 B: 738039

These day numbers can be used with card 2 to calculate future/past dates relative to a starting date. If you wish to convert the day numbers used by this program to Julian day numbers, simply add 1720982.

Calculate the day of the week for a given date

Load card 1. Enter the date into X, and press C. The day of the week will be returned in X. Sunday is 0, Monday is 1, proceeding through Saturday, which is 6.

Example:

What day of the week is the 2020 vernal equinox in the northern hemisphere?

3.192020 C: 4 (Thursday)

Calculate the day of the week for a given day number

Load card 1. With the day number in X (e.g. after computing a day number by pressing B), press D to calculate the day of the week. Output is the same as converting a date to the day of the week.

Calculate the date a given number of days before/after a starting date

Load card 1. Enter the starting date into X, and press B to compute the day number. Optional: save this day number in R7 or R8 if you intend to do multiple calculations with the same starting date.

Load card 2. Perform addition/subtraction on the day number in X. Optional: save the new day number in R7 or R8 if you wish to calculate multiple intervals. Press A and the new day number in X will be converted to a date in MM.DDYYYY format and returned in X. If you saved a day number in R7 or R8, you may recall the number and perform additional calculations/conversions.

Example:

What will be the date 57 days from now? 90 days from now?

Load card 1.

1.032020 B: 737870

STO 7

Load card 2.

57 +: 737927

A: 2.292020 Feb. 29, 2020 (Note: you may need to press DSP . 6 to see the full date.)

RCL 7: 737870

90 +: 737960

A: 4.022020 Apr. 2, 2020

Calculate the number of weeks + days between two dates

Load card 1. Enter the earlier date, press ENTER, and enter the later date. Press A to calculate the number of days between the two dates. Load card 2. Press B to convert the number of days to number of weeks + days in W.D format.

Example:

How many weeks + days until June 1st?

Load card 1.

1.032020 ENTER

6.012020 A: 150

Load card 2.

B: 21.3 (21 weeks and 3 days)

Program Code

Code:

`CARD #1`

LBL 23

A 11

B 12

g x><y 35 07

B 12

- 51

RTN 24

LBL 23

B 12

g X><Y 35 07

STO 1 33 01

g X><Y 35 07

ENTER 41

f 31

INT 83

STO 2 33 02

- 51

EEX 43

2 02

* 71

ENTER 41

f 31

INT 83

STO 3 33 03

- 51

EEX 43

4 04

* 71

STO 4 33 04

2 02

RCL 2 34 02

g x>y 35 24

GTO 22

1 01

1 01

3 03

STO 33

+ 61

2 02

1 01

STO 33

- 51

4 04

GTO 22

6 06

LBL 23

1 01

1 01

STO 33

+ 61

2 02

LBL 23

6 06

RCL 4 34 04

3 03

6 06

5 05

. 83

2 02

5 05

* 71

f 31

INT 83

RCL 2 34 02

3 03

0 00

. 83

6 06

0 00

0 00

1 01

* 71

f 31

INT 83

+ 61

RCL 3 34 03

+ 61

RCL 1 34 01

g X><Y 35 07

RTN 24

LBL 23

C 13

B 12

LBL 23

D 14

5 05

+ 61

ENTER 41

ENTER 41

7 07

/ 81

f 31

INT 83

7 07

* 71

- 51

RTN 24

CARD #2

LBL 23

A 11

STO 1 33 01

1 01

2 02

2 02

. 83

1 01

- 51

3 03

6 06

5 05

. 83

2 02

5 05

STO 5 33 05

/ 81

f 31

INT 83

STO 4 33 04

RCL 1 34 01

RCL 4 34 04

RCL 5 34 05

* 71

f 31

INT 83

STO 5 33 05

- 51

3 03

0 00

. 83

6 06

0 00

0 00

1 01

STO 6 33 06

/ 81

f 31

INT 83

STO 2 33 02

RCL 1 34 01

RCL 5 34 05

- 51

RCL 6 34 06

RCL 2 34 02

* 71

f 31

INT 83

- 51

STO 3 33 03

RCL 2 34 02

1 01

- 51

1 01

2 02

g x><y 35 07

g x>y 35 24

g x><y 35 07

- 51

STO 2 33 02

2 02

g x><y 35 07

g x>y 35 24

GTO 22

1 01

1 01

STO 33

+ 61

4 04

LBL 23

1 01

RCL 4 34 04

EEX 43

4 04

/ 81

RCL 3 34 03

+ 61

EEX 43

2 02

/ 81

RCL 2 34 02

+ 61

RTN 24

LBL 23

B 12

7 07

/ 81

ENTER 41

f-1 32

INT 83

- 51

g LSTX 35 00

. 83

7 07

* 71

+ 61

RTN 24