Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Parallel

Julian and Gregorian Calendars


The astronomical Julian-day number of the day specified by a date in either the Julian or the Gregorian calendar is the number of days elapsed from the day designated as January 1, 4713 B.C. in the Julian proleptic calendar. (See the textbox entitled, "The Proleptic Calendars" for more information.) Thus, the Julian-day number of 1/1/-4712 (J) is 0. Note that 4713 B.C. is the year -4712. The Julian-day number of 10/10/1992 is 2,448,906.


The Proleptic Calendars

Every date recorded in history prior to October 15, 1582 (Gregorian), such as the coronation of Charlemagne as Holy Roman Emperor on Christmas day in the year 800, is a date in the Julian calendar, since on those dates the Gregorian calendar had not yet been invented. We can, however, identify particular days prior to October 15, 1582 (Gregorian) by means of dates in the Gregorian calendar simply by projecting the Gregorian dating system back beyond the time of its implementation. A calendar obtained by extension earlier in time than its invention is called "proleptic."

For example, although the Gregorian calendar was implemented on October 15, 1582 (Gregorian), we can still say that the date one year before was October 15, 1581 (Gregorian), even though people alive on that day would have said that the date was October 5, 1581 (the Julian date at that time). As another example, the date of the coronation of Charlemagne was December 29, 800 in the Gregorian proleptic calendar.

Similarly, dates after October 15, 1582 (Gregorian) have equivalent, but different, dates in the Julian calendar. For example, this article was completed on October 10, 1992 in the Gregorian calendar, but we could equally well say that it was completed on September 28, 1992, in the Julian calendar. As another example, the date of the winter solstice in the year 2012 is December 21, 20012 (Gregorian), which is December 8, 2012 (Julian).

Thus, any day in the history of the Earth, either in the past or in the future, can be specified as a date in either of these two calendrical systems. The dates will generally be different. In fact, they will be the same only for dates from March 1, 200 to February 28, 300. The dates in neither calendar will coincide with the seasons in the distant past or distant future, but that does not affect the validity of these calendars as systems for uniquely identifying particular days.

Astronomers designate years by B.C. by means of negative numbers. In order to avoid a hiatus between the year 1 and the year -1, there has to be a year 0. Thus, astronomers adopt the convention: A.D. 1 is equal to Year 1; 1 B.C. is equal to Year 0; 2 B.C. is equal to Year -1; and so on. More generally, a year popularly designated n B.C. is designated by astronomers as the year -(n-1). Finally, the rules for leap years in both calendars are valid for the year 0 and for negative years, as well as for positive years.

--P.M.


There is a simple relationship between Gregorian-day numbers, as used in this method of date conversion, and Julian-day numbers. Given a Gregorian-day number, the corresponding Julian-day number is obtained by adding 2,299,161, the Julian-day number of October 15, 1582).

Listing One contains the header file, DATECONV.H, used by the date-conversion functions presented in this article. A structure Date contains values for day, month, and year, plus a value gdn (for Gregorian-day number, as explained shortly) and a flag indicating the validity of the date. A day/month/year value is ambiguous until the particular calendar is specified. A date is completely specified using an instance of the structure together with an instance of a separate char variable that has the value G or J.

/*  DATECONV.H -- Header file for date functions -- Last mod.: 1992-10-10  */
#define TRUE  1
#define FALSE 0
typedef struct
      {
      int day;
      int month;
      long year;
      long gdn;            /*  gdn and valid are for internal use  */
      int valid;           /*  by functions in this library  */
      } Date;
/*  declarations of functions defined in DATECONV.C  */
void date_to_gdn(Date *dt, char calendar);
void gdn_to_date(Date *dt, char calendar);
long lfloor(long a, long b);
int is_leap_year_c(long year, char calendar);
int is_leap_year(long year);
void set_feb_length(long yr, char calendar);
void reset_feb_length(void);
int day_of_week(long gdn);
Listing One


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.