Deltadays and date functions.
|
05-12-2017, 08:04 PM
Post: #21
|
|||
|
|||
RE: Deltadays and date functions.
(05-10-2017 01:28 PM)Vtile Wrote: I have been in seach of simple algorithm to calculate dDays between two dates. Now that various aspects of the algorithm have been discussed, here are three complete program listings for the 15C. Enter day [ENTER] month [ENTER] year, call [D] and get a serial number that allows to calculate the number of days between two dates by simple subtraction. 1. Compact version (33 steps), works for dates between 1 Mar 1900 and 28 Feb 2100. If you want the Julian day number, add 1720982 to the result. Code: 001 LBL D 2. Standard version (44 steps) that works down to the first day of the Gregorian calendar (15 Oct 1582). If you want the Julian day number, add 1720997 to the result. Code: 001 LBL D 3. Deluxe version (64 steps) with automatic switch between Julian and Gregorian calendar (4↔15 Oct 1582). Works down to 1 Mar 0000, returns Julian day number. Code: 001 LBL D In all versions one stack level is preserved so that date differences can be easily calculated with two successive runs of the program. 28 [ENTER] 2 [ENTER] 2100 f[D] → 2488128 (assuming deluxe version) 1 [ENTER] 3 [ENTER] 1900 f[D] → 2415080 (assuming deluxe version) [–] → 73048 days Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)