A = Y/100
B = A/4
C = 2-A+B
E = 365.25x(Y+4716)
F = 30.6001x(M+1)
JD= C+D+E+F-1524.5
This is the Julian Day Number for the beginning of the date in question
at 0 hours, Greenwich time. Note that this always gives you a half day extra.
That is because the Julian Day begins at noon, Greenwich time. This
is convenient for astronomers (who until recently only observed at night),
but it is confusing.
Example: If the date is 1582 October 15,
Y = 1582
M = 10
D = 15
A = 15
B = 3
C = -10
E = 2300344
F = 336
JD = 2299160.5
To convert a Julian Day Number to a Gregorian date, assume that it is for 0 hours, Greenwich time (so that it ends in 0.5). Do the following calculations, again dropping the fractional part of all multiplicatons and divisions. Note: This method will not give dates accurately on the Gregorian Proleptic Calendar, i.e., the calendar you get by extending the Gregorian calendar backwards to years earlier than 1582. using the Gregorian leap year rules. In particular, the method fails if Y<400. Thanks to a correspondent, Bo Du, for some ideas that have improved this calculation.
Q = JD+0.5
Z = Integer part of Q
W = (Z - 1867216.25)/36524.25
X = W/4
A = Z+1+W-X
B = A+1524
C = (B-122.1)/365.25
D = 365.25xC
E = (B-D)/30.6001
F = 30.6001xE
Day of month = B-D-F+(Q-Z)
Month = E-1 or E-13 (must get number less than or equal to 12)
Year = C-4715 (if Month is January or February) or C-4716 (otherwise)
Example: Check the first calculation by starting with JD = 2299160.5
Q = 2299161
Z = 2299161
W = 11
X = 2
A = 2299171
B = 2300695
C = 6298
D = 2300344
E = 11
F = 336
Day of Month = 15
Month = 10
Year = 1582
Practice: Calculate the Julian Day Number for 0 hours GMT on the
date of your birthday. Check your result by calculating the date of your
birthday from the Julian Day Number.
Remark: You can do the calculation of Julian Calendar Date-->Julian
Day Number by ignoring the calculation of A and B, and setting C=0; to go
from Julian Day Number to Julian Calendar Date, bypass the calculation of
W and X and simply set A=Z. These calculations are useful also when converting
between the Gregorian and Julian calendars (e.g., to correlate dates on
the Julian Calendar in England prior to 1752 with dates on the Gregorian
calendar). For example, to go from Gregorian to Julian calendar date, convert
the Gregorian date to Julian Day Number, then convert the Julian Day Number
to Julian calendar date. This method even works for dates prior to 1582
and correctly gives years prior to the Common Era as negative years (with
year 0 corresponding to 1 BCE, year -1 corresponding to 2 BCE, etc.) However,
it does not work with negative Julian Day Numbers and does not
work when going to the Gregorian calendar for years before 400 CE
.
To assist you in practicing Julian Day Number conversions, I have made up
a page that contains a Julian Day Number Calculator.
You can put any date in the Common Era (that is, AD) into this calculator,
and it will give you the Julian Day Number, on both the Julian Calendar
and the Gregorian Calendars. Or, you can put in a Julian Day Number and
it will compute the calendar date. Have fun!