moonman239
Sep 21st, 2009, 03:20 PM
I had a little incident trying to calculate today's Julian day number, and after failing to do so, I proceeded to develop the algorithm you see below. It's based on part of the algorithm I found for calculating the Julian day number. The accuracy of my algorithm varies depending on the number of years elapsed. For example I used my algorithm to calculate the days elapsed since January 1, 2000 and got a result that was just 1 day off. And I calculated again, using this date in 3000 as a start date, and got a result that was 9 days off.
Here's the algorithm:
A = floor(365.25 * Year)
B = floor(30.6001 * Month)
JD = A + B + Day + 1720995.0
Note the value of JD then repeat the process for date 2 and note the new value of JD. Then the days elapsed is the difference between both values.
Here's the algorithm:
A = floor(365.25 * Year)
B = floor(30.6001 * Month)
JD = A + B + Day + 1720995.0
Note the value of JD then repeat the process for date 2 and note the new value of JD. Then the days elapsed is the difference between both values.