Associated Topics || Dr. Math Home || Search Dr. Math

### Julian to Calendar Date Conversion

```
Date: 02/24/2001 at 14:53:12
From: Steven Attwell
Subject: Julian Date Conversion

I need to find an algorithm to convert Julian date values to calendar
date values. (e.g. Julian date 2451964 = 02/24/2001.)
```

```
Date: 02/25/2001 at 16:10:51
From: Doctor Fenton
Subject: Re: Julian Date Conversion

Hi Steven,

Thanks for writing to Dr. Math. I generally use one of two algorithms,
either that of Jean Meeus in "Astronomical Formulae for Calculators"
(an outstanding book), or the Fliegel-Van Flandern algorithm given in
the Astronomical Almanac. Here is Meeus's version: it works for any
positive Julian date.

1. Add .5 to the JD and let Z = integer part of (JD+.5) and F the
fractional part F = (JD+.5)-Z

2. If Z < 2299161, take A = Z

If Z >= 2299161, calculate alpha = INT((Z-1867216.25)/36524.25)
and A = Z + 1 + alpha - INT(alpha/4).

3. Then calculate:

B = A + 1524
C = INT( (B-122.1)/365.25)
D = INT( 365.25*C )
E = INT( (B-D)/30.6001 )

The day of the month dd (with decimals) is:

dd = B - D - INT(30.6001*E) + F

The month number mm is:

mm = E - 1, if E < 13.5
or
mm = E - 13, if E > 13.5

The year yyyy is:

yyyy = C - 4716   if m > 2.5
or
yyyy = C - 4715   if m < 2.5

An example from Meeus' book is for JD = 2436116.31

JD + 0.5 = 2436116.81, so

Z = 2436116

F = 0.81

alpha = INT((2436116 - 1867216.25)/36524.25 ) = 15

A = 2436116 + 1 + 15 - INT(15/4) = 2436129

Then
B = 2437653
C = 6673
D = 2437313
E = 11

So, dd = 4.81, mm = E-1 = 10, and yyyy = C-4716 = 1957, so the date
is:

Oct 4.81, 1957

If you have further questions, please write again. If you want the
Fliegel-Van Flandern algorithm, which uses only integer arithmetic,
write back, or if you can find the Explanatory Supplement for the
current Astronomical Almanac, I'm sure it has it.

- Doctor Fenton, The Math Forum
http://mathforum.org/dr.math/
```

```
Date: 05/29/2003 at 05:12:20
From: Roberto Fioravanti
Subject: Fliegel-Van Flandern algorithm

Can I have the Fliegel-Van Flandern algorithm to convert Julian date
values to calendar date values? (e.g. Julian date 2451964 =
02/24/2001.)
```

```
Date: 05/29/2003 at 08:39:20
From: Doctor Fenton
Subject: Re: Fliegel-Van Flandern algorithm

Hi Roberto,

Thanks for writing to Dr. Math.  The algorithm for converting from
a Julian date to a Gregorian date is the following.  Let J be the
Julian day number (since this algorithm uses integer arithmetic,
this will be the Julian day number which begins at noon on the
calendar day), and let Y, M, and D denote the corresponding calendar
date.

Then compute the following quantities, using integer arithmetic:

p = J + 68569
q = 4*p/146097
r = p - (146097*q + 3)/4
s = 4000*(r+1)/1461001
t = r - 1461*s/4 + 31
u = 80*t/2447
v = u/11  .

Then
Y = 100*(q-49)+s+v
M = u + 2 - 12*v
D = t - 2447*u/80 .

For example, using the data you supplied,

J = 2451964
p = 2520533
q = 69
r = 359
s = 0
t = 390
u = 12
v = 1

D = 23
M = 2
Y = 2001  .

It appears that you gave the integer part of the Julian date of
midnight for Feb. 24, 2001, which would be 2451964.5. This algorithm
gives the calendar date on which the Julian date 2451964 begins, which
is at noon on Feb. 23, 2001.

Just for completeness, although you didn't ask for it, here is the
Fliegel-Van Flandern algorithm to convert from a Gregorian calendar
date to the Julian date:

Given Y,M,D, the year, month, and date, define (using integer
arithmetic)

M1 = (M-14)/12
Y1 = Y + 4800 .

Then the Julian date J is

J = 1461*(Y1+M1)/4 + 367*(M-2-12*M1)/12 - (3*((Y1+M1+100)/100))/4
+ D - 32075  .

For example, for Y = 2001, M = 2, and D = 24,

M1 = -1
Y1 = 6801 ,

and

J = 2483700 + 367 - 51 + 24 -32075

= 2451965 .

These algorithms are available in the Explanatory Supplement to the
Astronomical Almanac, 2nd edition, P. Seidelmann (ed.), or in
Fliegel and Van Flandern's original paper,

Fliegel, H. F., and Van Flandern, T. C., "A Machine Algorithm for
Processing Calendar Dates," Communications of the Association of
Computing Machines, vol. 11 (1968), p. 657.

If you have any questions, please write back and I will try to
explain further.

- Doctor Fenton, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
College Algorithms