Julian Date Number/Gregorian Calendar Date Conversions
01-14-2019, 12:01 PM (This post was last modified: 01-14-2019 01:16 PM by Dieter.)
Post: #2
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
RE: Julian Date Number/Gregorian Calendar Date Conversions
(01-14-2019 01:21 AM)Eddie W. Shore Wrote:  HP Prime Program JD: Gregorian Date to Julian Date Number
Arguments: four digit year, month, day
JD(y,m,d)

Eddie, there is no need to calculate this manually with lots of formulas. You can do this with the Prime's built-in calendar functions:

For the Julian day number simply determine the date difference to 1582-10-15 and add 2299161.

For the Gregorian date subtract 2299161 from the Julian day number and add this number of days to 1582-10-15.

You will know the correct Prime syntax for this. ;-)

Edit: I have just posted a short 12C program using this approach in the General Software Library.

In both cases the date may not be earlier than Oct 15, 1982. This is the first day of the Gregorian calendar, earlier Gregorian dates simply do not exist. If you run your program with an earlier date the result will be invalid – the program works as if the Gregorian calendar existed before the mentioned date (proleptic calendar).

I don't know how the Prime behaves in this regard. Does it return an error for earlier dates?

(01-14-2019 01:21 AM)Eddie W. Shore Wrote:  Examples
Gregorian Date: 1998, October 31
JD: 2447466

Sorry, that's wrong. The JDN for this date is 2451118.
2447466 is the JDN of 31 Oct 1988.

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread Julian Date Number/Gregorian Calendar Date Conversions - Eddie W. Shore - 01-14-2019, 01:21 AM RE: Julian Date Number/Gregorian Calendar Date Conversions - Dieter - 01-14-2019 12:01 PM RE: Julian Date Number/Gregorian Calendar Date Conversions - Joe Horn - 01-14-2019, 11:13 PM RE: Julian Date Number/Gregorian Calendar Date Conversions - Eddie W. Shore - 01-16-2019, 02:48 PM RE: Julian Date Number/Gregorian Calendar Date Conversions - cdmackay - 01-16-2019, 08:18 PM RE: Julian Date Number/Gregorian Calendar Date Conversions - Albert Chan - 03-07-2019, 07:17 PM

User(s) browsing this thread: 1 Guest(s)