Interesting what you find in the Java SDK 1.4.2 API docs.  This from the entry on the GregorianCalendar object:

Historically, in those countries which adopted the Gregorian calendar first, October 4, 1582 was thus followed by October 15, 1582. This calendar models this correctly. Before the Gregorian cutover, GregorianCalendar implements the Julian calendar. The only difference between the Gregorian and the Julian calendar is the leap year rule. The Julian calendar specifies leap years every four years, whereas the Gregorian calendar omits century years which are not divisible by 400.

In other words, the period October 5th 1582 to October 14th 1582 did not exist in Britain, and many other countries.  It was sliced out of time, and did not happen.  This eleven day period was used in the BBC Doctor Who novels as the temporal "home" of Faction Paradox, a time-travelling voodoo cult.  Who said API docs were all dry and dusty?

However, dates obtained using GregorianCalendar are historically accurate only from March 1, 4 AD onward, when modern Julian calendar rules were adopted. Before this date, leap year rules were applied irregularly, and before 45 BC the Julian calendar did not even exist.  Prior to the institution of the Gregorian calendar, New Year's Day was March 25. To avoid confusion, this calendar always uses January 1. A manual adjustment may be made if desired for dates that are prior to the Gregorian changeover and which fall between January 1 and March 24.

So in the event your Java software needs to calculate a date, it had better be a date after 4 AD, and don't even think of calculating prior to 45 BC.  I think these people were suffering from post Y2K bug paranoia when they designed this thing.  All I was looking for was what exceptions it throws (IllegalArguementException and ArrayIndexOutOfBoundsException), but I'll take the bonus history lesson too.

Subscribe to Quantum Tea

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
Follow me on Mastodon