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

### Dated Determination: Converting from the Julian Calendar to the Gregorian

```Date: 02/09/2011 at 14:07:56
From: William
Subject: Converting a Julian calendar date to a Gregorian date

Hi!

How do you convert a Julian calendar date (e.g., 1987 Dec 14) to the
corresponding Gregorian date (in this case, 1987 Dec 27) and vice versa?
Are there any algorithms for this?

I get the general idea, but would really like to see a thorough, worked
example of the conversion, both from Julian to Gregorian and Gregorian to
Julian.

From what I understand so far, you'd have to first convert the Julian
calendar date to the Julian Day Number and then to a Gregorian date (same
strategy in the other direction). Is there a "better" way?

Thanks,
William

```

```
Date: 02/10/2011 at 16:15:23
From: Doctor Vogler
Subject: Re: Converting a Julian calendar date to a Gregorian date

Hi William,

Thanks for writing to Dr. Math.

Frankly, I rather like the strategy you described, because I think that
using a number-of-days figure is very useful for many other purposes.

But there is a different way of doing the conversion which you might
consider simpler: you just compute how many days off the two dates are.
The difference between the Julian and Gregorian calendars is that the
Julian one has a leap year every fourth year, while the Gregorian one
skips leap years on century years (like 1900) that are not divisible by
400. So the Gregorian calendar gains a day at the end of every February in
a century year that is not divisible by 400.

So you take the year number of the last 1st of March before your date (in
other words, use the previous year if your date is in January or
February), divide by 100 and round down. Then divide that same year by 400
and round down, and subtract the two quotients. Subtract two because the
two calendars are aligned in the A.D. 200s. Then add that many days of

and show me what you have been able to do, and I will try to offer further
suggestions.

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

```

```
Date: 02/11/2011 at 05:14:42
From: William
Subject: Converting a Julian calendar date to a Gregorian date

Thanks for the reply; it really helped!

I'm just wondering about the algorithm you described in the last
paragraph: "So you take the year number of the last 1st of March before
your date...." Does that algorithm have any limits? In other words, does
it only work up until a certain date, say, year 2500?

Also, what is it called? I'm doing this for a programming exercise that
converts between the two calendars, and it would be nice if I could refer
to the algorithm by some name.

William

```

```
Date: 02/12/2011 at 00:39:59
From: Doctor Vogler
Subject: Re: Converting a Julian calendar date to a Gregorian date

Hi William,

Thanks for writing to Dr. Math.

This method for date conversion works for any year, and is called "the
conversion between Julian and Gregorian calendars"!

Of course, the Gregorian calendar might not be in common use in the year
2500. But then the Julian calendar isn't in common use today, and yet here
we are invoking it in exercises for computer programming -- a technology
that did not exist when it was!

- Doctor Vogler, The Math Forum
http://mathforum.org/dr.math/
```
Associated Topics:
Middle School Calendars/Dates/Time

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search