The Julian date (JD) is a continuous count of days from 1 January 4713 BC (= -4712 January 1), Greenwich mean noon (= 12h UT). For example, AD 1978 January 1, 0h UT is JD 2443509.5 and AD 1978 July 21, 15h UT, is JD 2443711.125.
Formula for Conversion:
Conversion of Gregorian calendar date to Julian date for years AD 1801–2099 can be carried out with the following formula:
|JD =||367K - <(7(K+<(M+9)/12>))/4> + <(275M)/9> + I + 1721013.5 + UT/24
- 0.5sign(100K+M-190002.5) + 0.5
where K is the year (1801 <= K <= 2099), M is the month (1 <= M <= 12), I is the day of the month (1 <= I <= 31), and UT is the universal time in hours ("<=" means "less than or equal to"). The last two terms in the formula add up to zero for all dates after 1900 February 28, so these two terms can be omitted for subsequent dates. This formula makes use of the sign and truncation functions described below:
The sign function serves to extract the algebraic sign from a number.
Examples: sign(247) = 1; sign(-6.28) = -1.
The truncation function < > extracts the integral part of a number.
Examples: <17.835> = 17; <-3.14> = -3.
The formula given above was taken from the 1990 edition of the U.S. Naval Observatory's Almanac for Computers (discontinued).
Example: Compute the JD corresponding to 1877 August 11, 7h30m UT.
Substituting K = 1877, M = 8, I = 11 and UT = 7.5,
JD = 688859 - 3286 + 244 + 11 + 1721013.5 + 0.3125 + 0.5 + 0.5
See our Julian date converter.
Sample Code for Conversion:
Fliegel and van Flandern (1968) published compact computer algorithms for converting between Julian dates and Gregorian calendar dates. Their algorithms were presented in the Fortran programming language, and take advantage of the truncation feature of integer arithmetic. The following Fortran code modules and similar NOVAS modules (Fortran, C, and Python) are based on these algorithms. In the following code, YEAR is the full representation of the year, such as 1970, 2000, etc. (not a two-digit abbreviation); MONTH is the month, a number from 1 to 12; DAY is the day of the month, a number in the range 1-31; and JD is the Julian date at Greenwich noon on the specified YEAR, MONTH, and DAY.
Conversion from a Gregorian calendar date to a Julian date. Valid for any Gregorian calendar date producing a Julian date greater than zero:
INTEGER FUNCTION JD (YEAR,MONTH,DAY)
C---COMPUTES THE JULIAN DATE (JD) GIVEN A GREGORIAN CALENDAR
C DATE (YEAR,MONTH,DAY).
Conversion from a Julian date to a Gregorian calendar date.
SUBROUTINE GDATE (JD, YEAR,MONTH,DAY)
C---COMPUTES THE GREGORIAN CALENDAR DATE (YEAR,MONTH,DAY)
C GIVEN THE JULIAN DATE (JD).
Example: YEAR = 1970, MONTH = 1, DAY = 1, JD = 2440588.
Reference: Fliegel, H. F. & van Flandern, T. C. 1968, Communications of the ACM, 11, 657.