Back to index
DDAYS and DATE+ for the
HP-42S
Original date functions by Christoph Giesselink repackaged by
Erik
Ehrling (e.g. added type checking).
This is an implementation of the two date functions DDAYS
and DATE+ from the HP-48 which calculates the number of days between
two dates (DDAYS) and adds/subtracts a number of days to a given date
(DATE+). All dates within the Gregorian calendar from the start the
15th October 1582 up to
the 31st December 9999 are supported.
Note: This version hides the underlying
functions D2J and J2D. If you are interested in these functions you'd
be better of with the full package of date
functions
Usage:
DDAYS:
Enter two dates on the stack
Y: start date (format mm.ddyyyy)
X: end date (format mm.ddyyyy)
and then run DDAYS. The result will be the number of days between the
start date and the end date.
DATE+:
Y: original date (format mm.ddyyyy)
X: number of days to add (positive or negative)
and then run DATE+. The result will be the original date + given number
of days (on the format mm.ddyyyy)
Technical notes:
The program is built up around two functions for converting a Gregorian
date into a Julian date (LBL 08 in the program) and a Julian date into
a Gregorian date (LBL 10) based on algorithms by R. G. Tantzen. Around
these functions is a wrapper that does validation of the input,
converts dates into their Julian representation, does the subtraction
or addition and then converts back into Gregorian format.
References:
Robert G. Tantzen: "Algorithm 199: Conversions between calendar date
and Julian day number" in Communications of the ACM, Volume 6, Issue 8
(August 1963)
Binary files for emulators:
Raw binary: date.raw Binary for
HP-42X: date.42x
Generated by 42s2html - 31
January 2004, 12:03