# Determine Julian Date from Gregorian without formula

As an exercise, I am trying to calculate the JD from a given date in the Gregorian Calendar at a time given in UT. Furthermore, I want to do so from first principles without relying on any formula. Let's say I choose UT 18:30 on 2/28/2010. I am not able to obtain a result consistent with the U.S. Naval Observatory results. I am in need of a calendar guru to show me where my calculation is going astray.

First I find the number of years from 4713 BCE (Julian Date 0) and the target year making sure to add an extra one so as to include 0 CE. This is $$4713 + 1 + 2010 = 6724$$ years. The number of these years which are leap is $$\frac{6724}{4} - 3 = 1681$$. This equation attempts to reflect that every fourth year is a leap year except for those years falling after 1582 (the year of the Gregorian Calendar reform) which are both divisible by $$100$$ and not by $$400$$. There are three such years which need to be deducted from the total-- 1700, 1800, 1900. This leaves $$6724 - 1681 = 5043$$ non-leap years.

Now I convert these to days and subtract the $$10$$ days which were skipped as part of the reform from October 4 to October 15 in 1582. $$5043*(365) + 1681*(366) - 10 = 2,455,928$$. Next, I find the number of days from January 1st to the target day in the target year (February 28th). This is $$59$$ days and so I have $$2,455,987$$.

Finally, the time number of seconds afternoon on the target day is calculated as a fraction of the number of seconds in a 24 hour period. This works out to be $$\frac{6(60)(60) + 30(60)}{24(60)(60)} \approx 0.27$$. Adding this to the earlier result yields $$JD = 2455987.27$$.

The actual answer is $$2455255.77$$ which leaves a difference of $$2455987.27 - 2455255.77 = 731.5$$ days. This is nearly two years. Obviously, I have either misunderstood the calculation or have performed it incorrectly. Any help would be much appreciated!

• USNO Julian Date Converter returns JD 2455256.27 for 2010-02-28 18:30 UT. There is no year 0, so 1 CE - 1 BCE = 1 year; subtract 1 year instead of adding 1. MJD is simpler to compute. – Mike G Feb 26 '19 at 3:40
• Wow this is a very interesting question! – Max0815 Feb 26 '19 at 20:29

The Year 0 does not exist in BCE/CE and BC/AD notation. It jumps from 1 BCE to 1 CE directly. So if we look at the sequence of years in BCE/CE notation, we have:

3 BCE
2 BCE
1 BCE
1 CE
2 CE
3 CE


If you want to calculate the number of years between, say, January 1, 2 BCE and January 1, 2 CE, you can add the year numbers to get 4, but then you need to subtract 1 to remove year 0 from the total, giving a total of 3 years. In your particular case, this leads to $$4713 - 1 + 2010 = 6722$$ years.

In astronomy, we often use another year numbering system called the Astronomical year numbering, which includes a year 0 and makes things more convenient arithmetically when calculating time intervals between eras. It goes (-3, -2, -1, 0, 1, 2, etc.) To convert years BCE to the Astronomical year notation, we subtract 1 and add minus(-) in front of the year. For example, the year 4713 BCE is -4712 in Astronomical year notation. Your year interval is then calculated as $$2010 - (\text{-}4712) = 2010 + 4712 = 6722$$.

For the leap years calculation, since -4712 is a leap year, this simplifies matters, but don't forget to take the smallest integer greater than or equal to your result (the ceiling function). So in this case $$\frac{6722}{4} - 3 = 1677.5$$, and the ceiling is 1678, and that is the number of leap years between your years. Also, in your initial calculation, you had forgotten to subtract 3, because 6724 / 4 - 3 = 1678, not 1681.

Finally, the time interval between January 1 and February 28 is 58 days, not 59, because we do not count the last date as part of the interval. This gives a total of $$5044 * 365 + 1678 * 366 - 10 + 58 + \frac{6 * 60 * 60 + 30 * 60}{24 * 60 * 60} = 2455256.27$$.

You state that the actual answer is 2455255.77, but in fact the answer really is 2455256.27. Perhaps you typed "06:30" instead of "18:30" in the converter.