INT(x) = [x] NOTE: some computer languages have a different definition.
FIX(x) = the number x without its fraction. For example, FIX(-1.5)=-1
x\y = FIX(x/y)
STEP 1 Let JD be the Julian Day Number. Calculate
R = the fractional part of JD - 1721118.5 = (JD - 1721118.5) - Z
STEP 2 Calculate the value of A which is the number of full centuries:
where 0.002929687499688476 < K1 < 0.2521972656249999
STEP 3 Calculate the days within the whole centuries (in the Julian Calendar) by adding back days removed in the Gregorian Calendar. The value of B is this number of days minus a constant.
where 0 < K2 < 0.25
(It is sometimes convenient to make K1 = K2 = 0.25.)
STEP 4 Calculate the value of Y, the year in a calendar whose years start on March 1:
STEP 5 Calculate the value of the day count in the current year using ONE of the following:
C = B - INT(365.25*Y)
where C is an integer and B is a real.
STEP 6 Calculate the value of the month in the current year using ONE of the following:
(Note that 16384 is 2^14 and the division can be implemented with shifts if the number has a binary representation.)
(Note that 65536 is 2^16 and the can be implemented by taking the upper 16 bits of a 32 bit number.)
where K3 = .0326530612244898 to 0.03271028037383177
STEP 7 Calculate the value of F, which is the number of days in the preceding months in the current year, using ONE of the following methods:
STEP 8 The Gregorian date's day of the month is
STEP 9 Convert the month and year to a calendar starting January 1, using ONE of the following methods:
The Gregorian date has
Year = Y
Month = M
This calculation is valid for any Julian Day Number including negative JDN and produces a Gregorian date (or possibly a proleptic Gregorian date).
Example
The following sequence calculates Gregorian year Y, month M, and day D from a Julian Day Number:
Z = INT(JD - 1721118.5) | step 1 |
R = JD - 1721118.5 - Z | step 1 |
G = Z - .25 | used in later steps |
A = INT(G / 36524.25) | step 2 |
B = A - INT(A / 4) | part of step 3 |
year = INT((B+G) / 365.25) | part of step 3 and step 4 |
C = B + Z - INT(365.25 * year) | step 5 |
month = FIX((5 * C + 456) / 153) | step 6 |
day = C - FIX((153 * month - 457) / 5) + R | step 7 and 8 |
IF month > 12 THEN | step 9 |
year = year + 1 | step 9 |
month = month - 12 | step 9 |
END IF | step 9 |
INT(x) = [x] NOTE: some computer languages have a different definition.
FIX(x) = the number x without its fraction. For example, [-1.5]=-1
x\y = FIX(x/y)
STEP 1 Let JD be the Julian Day Number. Calculate
R = the fractional part of JD - 1721116.5 = (JD - 1721116.5) - Z
STEP 2 Calculate the value of Y, the year in a calendar whose years start on March 1:
STEP 3 Calculate the value of the day count in the current year:
C = Z - INT(365.25*Y)
STEP 4 Calculate the value of the month in the current year using ONE of the following:
(Note that 16384 is 2^14 and the division can be implemented with shifts if the number has a binary representation.)
(Note that 65536 is 2^16 and the can be implemented by taking the upper 16 bits of a 32 bit number.)
where K3 = .0326530612244898 to 0.03271028037383177
STEP 5 Calculate the value of F, which is the number of days in the preceding months in the current year, using ONE of the following methods:
STEP 6 The Julian date's day of the month is
STEP 7 Convert the month and year to a calendar starting January 1, using ONE of the following methods:
The Julian date has
Year = Y
Month = M
This calculation is valid for any Julian Day Number including negative JDN and produces a Julian date (or possibly a proleptic Julian date).
Example
The following sequence calculates Julian year Y, month M, and day D from a Julian Day Number:
Z = INT(JD - 1721116.5) | step 1 |
R = JD - 1721116.5 - Z | step 1 |
year = INT((Z -0.25) / 365.25) | step 2 |
C = Z - INT(365.25 * year) | step 3 |
month = FIX((5 * C + 456) / 153) | step 4 |
day = C - FIX((153 * month - 457) / 5) + R | step 5 and 6 |
IF month > 12 THEN | step 7 |
year = year + 1 | step 7 |
month = month - 12 | step 7 |
END IF | step 7 |
LAST MODIFIED: October 11, 2005