Deltadays and date functions.
|
05-14-2017, 05:21 PM
(This post was last modified: 05-14-2017 05:29 PM by Dieter.)
Post: #29
|
|||
|
|||
RE: Deltadays and date functions.
(05-12-2017 11:15 PM)Paul Dale Wrote: It won't work back until 1 March 0000. Of course Pauli is right regarding the first AD years. Also the Julian calendar was introduced as late as 46 BC, and JDN calculations for all dates before this assume that the calendar's final form was used even centuries and millenniums before. But this assumption is common practice (proleptic calendar), just as the astronomical year numbering where e.g. 333 BC equals year –332. All this is also the way the 34s works. So here finally is another program version for the 15C (and most other classic RPN HPs) that – with the mentioned caveats – works down to 1 Jan –4712, i.e. 1 Jan 4713 BC, which is considered day 0 of the Julian day number system. Using a small trick, the missing floor() function for negative years was replaced with the 15C's int(). Code: 001 LBL D Check: 1 [ENTER] 1 [ENTER] -4712 f[D] → 0 4 [ENTER] 10 [ENTER] 1582 f[D] → 2299160 15 [ENTER] 10 [ENTER] 1582 f[D] → 2299161 4 [ENTER] 7 [ENTER] 1979 f[D] → 2444059 As usual, the program does the transition between Julian and Gregorian calendar on the official switch date, i.e. from 4 to 15 Oct 1582 (cf. example above). You may adjust this date by changing the hardcoded constant 2299161 (JDN of 15 Oct 1582) to another value that reflects your local situation. This value is obtained by determining the JDN of the first Gregorian date (using the unmodified program). For instance in Great Britain and its colonies, including the US, 2 Sep 1752 was followed by 14 Sep 1752. So enter 14 Sep 1752 and get 2361222, which then is the value to code in line 043...049. Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 8 Guest(s)