Click here for RAC Consulting Sponsor Message

Connecting the Threads of Time

Writing date-oriented software is harder than it looks.
Just ask George Washington.

By Wayne E. Holt
Director of Research & Development
Software Research Northwest, Inc.

Introduction by F. Alfredo Rego
R&D Manager, Adager Labs

Some people might think that writing date-oriented software is a piece of cake. This excellent article by Wayne Holt will show you that this is a myth. Fred White has spent many months researching all the possible nuances of this tricky topic while constructing Adager's core library of date-examining and date-changing procedures. Fred's job was so thorough that it was a pleasure for me to incorporate his work into Adager's overall architecture. As part of his self-imposed dissertation on the subject, Fred asked many innocent-sounding questions to many unsuspecting colleagues. What follows is only a small part of Wayne's answer. Fortunately, I got copies of the e-mail exchanges between Fred and Wayne. I was so enthralled that I asked Wayne's permission to publish his comments.

Simple Questions
It all started with two deceptively simple questions from Fred White:

1. To be trustworthy, must a "calendar routine" observe the so-called lost days of September, 1752?

2. Must it have a Year Zero?

The Internet HP3000-L message traffic in late 1996 and early 1997 buzzed with proposals and counter-proposals regarding new and improved date intrinsics for MPE/iX. What formats should be supported? Should they do date differencing? How far back in time should they go and how far forward? How compatible should they be with existing routines on other operating systems?

What should they do about a Year Zero? And what about those missing (or "lost") days?

It is in these last two questions that key differences appear to exist among "standard" routines.

It turns out the deceptively simple answers to these two questions are a resolute "it depends" on what you are trying to do! And it also turns out there is quite a lot of misinformation scampering about, which is all-too-often fed to us as the sound bytes of the quick answer "well, everybody knows that..."

In order to meander our way through the rhetoric of these answers, we need to define a number of terms related to calendars.

Ab urbe condita, meaning From the founding of Rome, is nomenclature related to naming the year as used within the Roman calendar. Rome was founded in 753 BC (more or less), which was AUC 1.

Julian Calendar
The Julian Calendar was established January 1st, 45 BC (AUC 708). It was named for Julius Caesar (a Roman) and is notable for moving New Year's Day to January 1st and for adding consistent rules for inserting leap years. It was recalibrated in AD 525 (AUC 1279) by Dionysius Exiguus (Dennis the Little) to adopt the "anno Domini (AD)" nomenclature (with AD 1 starting January 1st, AUC 754). The Julian Calendar has no Year Zero.

Gregorian Calendar
The Gregorian Calendar was established October 15th, AD 1582. It was named for Pope Gregory XIII (an Italian) and is virtually identical to the Julian Calendar but follows "improved" rules for leap years and ties March 21st to the vernal equinox. The Gregorian Calendar has no Year Zero.

Proleptic calendars
A proleptic calendar is any calendar which is used to label a date that existed before the calendar methodology itself existed. This is how there can be dates prior to 45 BC (Julian proleptic Calendar) and dates prior to AD 1582 (Gregorian proleptic Calendar) that are meaningful when related to modern dates. For instance, it doesn't mean much to say that Caesar defeated Pompey the Great (Gnaeus Pompeius Magnus) in AUC 705; by reference, it is much more useful to know he did so in 49 BC.

Civil calendars
Civil calendars are the calendars utilized by any given government to enumerate the passage of time. They vary widely from country to country.

While the world does not have a unified civil calendar, for political and economic reasons worldwide commerce centers around the Gregorian Calendar. Any dates we mention in this article without specific "reference" should be assumed to be Gregorian.

Old Rules
The term "Old Rules" is used to indicate the practice of observing March 25th as New Year's day, regardless of Julian or Gregorian rules.

Julian Period
The Julian Period (and associated Julian Day) was introduced in AD 1581 by the French scholar Joseph Scaliger (presumably named for his father, Julius Scaliger). It covers a 7,980 year period, aligns the Metonic Cycle (19 years) with the Solar Cycle (28 years) and the Indiction (Tax) Cycle (15 years). It is valid from November 22nd 4714 BC to January 23rd AD 3268 and is used by astronomers for simplicity. A Julian Day is noted by a unique positive number, varying from 1 to 2914695. Using astronomical notation, which imposes years on this timeline, there is a Year Zero and "+ -" symbols are used instead of "AD/BC".

Year Zero
Let's start with the Year Zero issue. When you are talking about either the Julian or Gregorian Calendars, there is no zero. Why not? Well, in the first place, the Romans did not have a symbol for zero. As a concept, it still didn't get any respect in the 6th century when Little Dennis did his thing with AD. Thus, it is not surprising that the year before AD 1 is 1 BC. No zero.

Trouble is, in our life and times and modern number theory, to do arithmetic correctly across the "AD/BC" number boundary, you need zero!

The Julian Period provides this and more. Simply put, in the nomenclature of the Julian proleptic Calendar, any date occurring between noon on January 1, 4713 BC and noon on January 1, AD 3268 can be expressed as a unique number. The number of days between any two dates is the simple difference between the two numbers. These "Julian Days" may then be expressed in astronomical notation, where "+" and "-" symbols are used instead of AD and BC.

Most important, this notation has a Year Zero. It handles "year" mappings as follows:

Year 1 BC = "Year 0"

Year 2 BC = "Year -1" and so on. Hence, 4713 BC is the same as -4712 in astronomical notation.

"Julian" or Julian?
By the way, conspiracy theorists would have a field day with the horrible coincidence of the "Julian" name of this format. While some steadfastly maintain it was named after Joseph Scaliger's father, many believe it was named after the Julian Calendar (with which it aligns), in defiance of papal authority.

What does the year zero (or lack thereof) mean for algorithms?

It means that recognizing or not recognizing Year Zero can be good or bad, depending on the context. If the routine is intended to cross the "birth of Christ" boundary, it should be able to translate "AD/BC" dates from the Julian or Gregorian calendars into Julian Period Days, and come up with the right answer. If it allows Year Zero, it should not conflict its "+ -" nomenclature with the "AD/BC" nomenclature.

Missing days
If a calendar is based on the Gregorian proleptic Calendar, it will manipulate dates as if the Gregorian Calendar has been in use since the beginning of time. Thus, there are no "missing" days in either October, AD 1582 or September, AD 1752 -- the months during which many of the world's governments adopted the Gregorian Calendar as their "civil calendar."

Some date routines, especially those that conveniently display a formatted calendar for you, are written from an ego-centric point of view, reflecting the assumption that "everyone in the world" must have "lost" 10 or 11 days at the same time. A proleptic calendar routine would make no such assumption.

Iconoclastic thoughts
We offer these iconoclastic thoughts for your consideration:

1. No calendar lost any days, regardless of what you may read to that effect.

2. People thought they lost days because of the linear progression of dates in their civil calendar.

3. People in different countries think they "lost" (or are still to lose) between 10 and 13 days, depending on actions of their governments.

Hear us out. When Pope Gregory ordered 10 days stricken from the calendar in AD 1582, the Julian Calendar was not affected. That's right. No days were lost from the original Julian Calendar. It kept right on ticking, never missing a beat. In France (and a lot of other countries) the date may have gone from October 4th to October 15th, but in England it was only October 5th. The Julian calendar did not change.

Instead, a new calendar -- the Gregorian Calendar -- was adopted and the date was 10 days later than it had been the previous day. If the Pope had renamed the months, and started the calendar at 1 instead of 15, people would have had an altogether different reaction -- more like the insanity when Julius Cæsar created his calendar in 45 BC by making the previous year one of 445 days -- and the concept of "losing" 10 days would never have come up. But he didn't, and to the people who no longer had access to those days, in their minds, they lost them.

What should a routine do?
OK, we'll buy that: The people lost some number of days in the linear progression of their civil calendar. But, should a calendar routine try to show it?

Here's the rub with routines that have to make assumptions. Scotland switched over in 1600 -- because business with the French was more lucrative than business with England, and dates are an important part of commerce. One by one, most of the Catholic countries made the switch until Protestant England (and her colonies, including The United States) caved in and changed calendars in AD 1752. By that time, the difference was 11 days (1 day every 128 years).

Russia made the leap in AD 1918 (was the October revolution really in November?), Turkey in AD 1927 and Ethiopia is probably still on the Julian Calendar.

The rub?
Some of these programs show a calendar with September AD 1752 short 11 days. Would this make sense to a frenchman, a russian, or a turk? No! From their points of view, the number of "missing" days was a different number, and the magic happened in a different month and year.

Here is the quibble... if someone is going to write a calendar routine that tries to account for the linear progression of civil dates, they must tie it to the civil calendar of a given country. This is not something these routines ever try to do.

And, if you can't do it right, should you do part of it? Well, when you do, it leads to our inability to track the "dates we are told things happened on" to the day they really happened on.

To "do it right" in The United States, the routine must: 1. Delete the days 3rd - 13th September AD 1752; 2. Use the Julian Calendar for dates prior to September 14th; 3. Change the year on March 25th and not January 1st, starting on March 25th, AD 1751.

Reality (and the law)
Deleting the days? OK, most US-centric routines do this. Switch to Julian? Sure, most do. But by doing this they make you have to know the "original" dates of events. And this can be very confusing, since today all dates have been adjusted using "Gregorian proleptic rules."

The reality is that we have absorbed the "missing 11 days" of September AD 1752. We know nothing could have happened on those missing days, but if you check the records we keep today, they point to things that happened on those days! It's not historical revisionism, it is simply relabeling the date reference to align with our current civil calendar.

When the British Empire changed over to Gregorian, they "more or less" adopted the "proleptic" approach of changing the historical dates to match the new calendar. And that means there "are no dates to lose" in September AD 1752, since the backwards dating of historical events operates as if those dates were there. In fact, the Calendar Act of AD 1751 specifically stated that all legal transactions and birthdays were to take place on their "natural days," with the date adjusted (proleptically) to the Gregorian scheme. Which means that, for better or for worse, from the future looking back, there are no missing days.

George Washington
Take George Washington. Look up his birthdate -- February 22nd, AD 1732, right? Well, not really. George was born under the Julian Calendar, years before the Gregorian changeover, on Friday February 11th in AD 1731 and, using the "old rules," just a month before the end of the year.

George was not born an aristocrat; had he been, as was the aristocratic custom of the day, his parents might have written his year of birth as AD 1731/32, indicating their sophistication in knowing that it was already 1732 in Europe. Now, how do you type that into most calendar programs?

If you use a calendar routine that "drops" 11 days from the calendar, but look up Georgie using February 22nd, you will get some incorrect results as to his weekday of birth and age at death.

Have you had a long day?
And this is where such routines really fail in presenting information to the user. The March 25th of the year AD 1751 was preceded (by one day) by March 24th, AD 1750 in the Julian Calendar, using English "old rules".

Are you missing some months?
The algorithm must not only deal with this requirement, it must also deal with the problem that, to the English and their colonies, 1751 had no January, February, or March. These last three months of the year were given to 1752, becoming its first three months! Worse, the routine must go back to January 1st as the start of the year for dates earlier than AD 567, when the Council of Tours deviated from the original Julian Calendar.


Rocket science
And who could use such a routine, if it were right? Do the average users today understand the issues well enough to know what they should type in?

Doubtful! The upshot is that these routines are most often only partly right, and still require special knowledge to operate them correctly. But they can be very useful as civil calendars, as long as you know their assumptions and their limitations.

As we climb off our soap boxes, we acknowledge it is hard to leave well enough alone. People often ask what years are leap years and why. In a future article, we will share some historical perspectives on the practice of intercalation and in the process give you some formulae for mapping one calendar to another.

We leave you with a teaser. What day in a leap year is the actual leap-day? (Hint: by custom, it is not February 29th!)

Copyright 1997, The 3000 NewsWire. All rights reserved.