Home + About me + E-mail me

Calendar Notes

Nigel's playing with calendars

Play here

For this programme, the base line for all calendars is an enumeration of days, counting day zero on 1954-04-12, or nib+0. On this basis, today (1999-02-19) is nib+16384, and 0001-01-01 AD is nib-713421. As 1954-04-12 was a Monday, the day of the week is nib%7 with 0=Monday. The papers by Dershowitz and Reingold use a count where day 1 is Monday Jan 1st 1 CE (Gregorian) = Monday 0001-01-03 AD (Julian), so [absolute day number] = [nib] + 713420, and adn%7 gives the day of the week with 0=Sunday.


I assume the Julian style starting on 0001-01-01, with the first leap in 0004, and every fourth year after that, changing to the Gregorian at various times as recounted below. Years start on -01-01, though we have to recognise that the civil or legal year started on different days at various times. For now, for England, we assume that the historical year always started on -01-01, though up to 1751 the civil year started on Lady Day, -03-25. Before the 14th century the start of the year appears to be unstandardised, and was often Christmas day -12-25, though of which year I'm not certain. Here, between 1301-01-01 and 1751-12-31 we will just give the historical year N, with a note, if the date is between -01-01 and -03-24 inclusive, that this is also known as civil year N-1. Civil 1752 started on 1752-01-01 (see Calendar (new style) Act 1750 (24 Geo 2 c 23)).

Key dates here:

	0001-01-01 = nib-713421 (Sa)
	1301-01-01 = nib-238596 (Fr)
	1751-12-31 = nib-73870 (Tu) (England only)

The Gregorian style has 400-year cycles, with 97 leaps in each. Every year divisible by four is a leap, except years divisible by 100, which are leap only if also divisible by 400. This calendar was adopted at various times in various countries. At the same time, various numbers of days were skipped to bring the calendar back into line with the seasons, though not all that might have been expected from the number of extra leaps in the Julian compared with the Gregorian at the time of changeover, presumably as the calendar did not really start in 0001. Most of Catholic Europe changed in 1582, omitting ten days in October by having 1582-10-15 follow 1582-10-04. Before 1582, there were 12 years that were leap under the Julian system that wouldn't have been under the Gregorian system: 100, 200, 300, 500, 600, 700, 900, 1000, 1100, 1300, 1400, 1500. England and its dominions (inc what's now the USA) changed in 1752, by having 1752-09-14 follow 1752-09-02. This omitted 11 days (as 1700 had been leap in England and not in France) and brought us back into agreement. The years of change were:

	1582	Italy, France, Spain, Portugal
	1583	Prussia, RC Germany, Switzerland, Holland, Flanders
		(on -01-01, whatever that means)
	1586	Poland
	1587	Hungary
	1700	Protestant Germany and Netherlands and Denmark
	1752	Great Britain and Dominions
	1753	Sweden (omitted the leap in 1700, went back to Julian with
		2 leaps in 1712, then 1753-02-17 was followed by 1753-03-01,
		omitting 11 days)
	1872	Japan
	1912	China
	1915	Bulgaria
	1918	Turkey and Russia
	1919	Yugoslavia and Romania
	1923	Greece

In the UK, the Julian calendar was adopted gradually, until it was mandated by the Council of Chelsea in AD 816 (0816-01-01 = nib-415743).

Key dates here:
	England				France
	1582-10-01 = nib-135688		1582-10-01 = nib-135688
	1582-11-01 = nib-135657		1582-11-01 = nib-135667
	1752-09-01 = nib-73625		1752-09-01 = nib-73636
	1752-10-01 = nib-73606		1752-10-01 = nib-73606

What happened in detail:
                England                         France
                1582 October                    1582 October
                Mo Tu We Th Fr Sa Su            Mo Tu We Th Fr Sa Su
                 1  2  3  4  5  6  7             1  2  3  4 15 16 17
                 8  9 10 11 12 13 14            18 19 20 21 22 23 24
                15 16 17 18 19 20 21            25 26 27 28 29 30 31
                22 23 24 25 26 27 28
                29 30 31

                England                         France
                1700 February                   1700 February
                Mo Tu We Th Fr Sa Su            Mo Tu We Th Fr Sa Su
                          1  2  3  4             1  2  3  4  5  6  7
                 5  6  7  8  9 10 11             8  9 10 11 12 13 14
                12 13 14 15 16 17 18            15 16 17 18 19 20 21
                19 20 21 22 23 24 25            22 23 24 25 26 27 28
                26 27 28 29

                England                         France
                1752 September                  1752 September
                Mo Tu We Th Fr Sa Su            Mo Tu We Th Fr Sa Su
                    1  2 14 15 16 17                         1  2  3
                18 19 20 21 22 23 24             4  5  6  7  8  9 10
                25 26 27 28 29 30               11 12 13 14 15 16 17
                                                18 19 20 21 22 23 24
                                                25 26 27 28 29 30

Because it is used as a reference by several works, there is also an implementation of the extended Gregorian. This is just a projection back of the current calendar, assuming leaps as now, and including a (leap) year zero. On this system, what is commonly called 4 BC (Julian) is approximately year -3.


This short-lived experiment was used from Sun 1793-11-24 to Tue 1805-12-31, inclusive, before and after which the Gregorian was used. The epoch was Sat 1792-09-22, the autumnal equinox and first day of the Republic.

It had 12 months of 30 days each, plus five (or six in leap years) other days. The months were: Vendemiaire, Brumaire, Frimaire, Nivose, Pluviose, Ventose, Germinal, Floreal, Prairial, Messidor, Thermidor, Fructidor (accents missing). Each month was divided into three decades of ten days each, the tenth day only being a rest day. Days within each decade were: Primidi, Doudi, Tridi, Quartidi, Quintidi, Sextidi, Septidi, Oxtidi, Nonidi, Decadi. Each day had 10 hours each of 100 minutes, each of 100 seconds (100000 sec per day instead of the usual 86400). The five odd days had special names and were not in any particular month, occurring after the 12th month and before the next year. The days were Jour de la Vertu, J du Genie, J du Labour, J de la Raison, J de la Recompense, and in leap years J de la Revolution. These were all holidays.

The leap year rule is obscure. The new year, 1 Vendemiaire was to occur at the autumnal equinox, but this didn't work, and later a rule was proposed. In fact, leap years happened in the 3rd, 7th and 11th years of the calendar's actual use. Presumably, year 1 was the year starting 1792-09-22, so the year starting in 1805-09, the final (part) year was the 14th year. The calendar came into use, therefore, early in its year 2.

Key dates are:
	1792-09-22 = nib-59005
	1793-11-24 = nib-58577
	1805-12-31 = nib-54158


Defines the suffix or prefix letter used in the UK for car registrations. Plates varied over the early years, with simple forms such as a n, aa nn, and aa nnnn. Later the form aaa nnn seems common, and after that nnn aaa, where the alpha part tended always to be three letters, and the numeric 1 to 999 with no leading zeroes. In the early 1960s (AD!) the form nnnn aa was also used. From 1963 an annual change was introduced, although some licensing areas did not start the new system until 1965 or later. From 1963-01-01 until 1963-12-31 the form was aaa nnnA; this system continued until the year 1966-01-01 to 1966-12-31 which used aaa nnnD. Then from 1967-01-01 until 1967-07-31 it was aaa nnnE, and from 1967-08-01 until 1968-07-31 it was aaa nnnF. Then an annual change at -08-01 continued until aaa nnnY finished on 1983-07-31. Then from 1983-08-01 until 1984-07-31 it was Annn aaa, and this format continued on an annual basis changing on -08-01 until Rnnn aaa finished on 1998-07-31. Then Snnn aaa ran from 1998-08-01 until 1999-02-28. Tnnn aaa started on 1999-03-01 and ran for six months to 1999-08-31. The system then continued changing at 6-monthly intervals until Ynnn aaa finished on 2001-08-31. Only the following letters were used for suffix or prefix letters: ABCDEFGHJKLMNPRSTVWXY (a total of 21, omitting IOQUZ). The special format Qnnn aaa was used for imports or kit cars that did not have a clear year of first registration. The final one or two letters in the alpha group had, especially in the early days, some significance in indicating at which tax office the vehicle was first registered. From 2001-09-01 onwards a new system was introduced, still changing every six months, LLnn AAA, where LL is a 2-letter regional identifier, nn is two digits related to time of registration, and AAA is 3 random letters. I and Q are not used, except that Q may still be used in the former style for vehicles with unclear registration dates. Z is used only in the random part. The number part is the last two digits of the year for the registration beginning in March, and the same plus 50 for the September registration. After this system runs out at the end of Feb 2050, it has been suggested than the format AAA nnLL will be used, with nn being 00 for the first six months from 2050-03-01. This suggestion has not yet been incorporated into the code. The complete system as known at 2001-09-11 is:

	-A	1963-01-01 to 1963-12-31
	-B	1964-01-01 to 1964-12-31
	-C	1965-01-01 to 1965-12-31
	-D	1966-01-01 to 1966-12-31
	-E	1967-01-01 to 1967-07-31
	-F	1967-08-01 to 1968-07-31
	-G	1968-08-01 to 1969-07-31
	-H	1969-08-01 to 1970-07-31
	-J	1970-08-01 to 1971-07-31
	-K	1971-08-01 to 1972-07-31
	-L	1972-08-01 to 1973-07-31
	-M	1973-08-01 to 1974-07-31
	-N	1974-08-01 to 1975-07-31
	-P	1975-08-01 to 1976-07-31
	-R	1976-08-01 to 1977-07-31
	-S	1977-08-01 to 1978-07-31
	-T	1978-08-01 to 1979-07-31
	-V	1979-08-01 to 1980-07-31
	-W	1980-08-01 to 1981-07-31
	-X	1981-08-01 to 1981-07-31
	-Y	1982-08-01 to 1983-07-31
	A-	1983-08-01 to 1984-07-31
	B-	1984-08-01 to 1985-07-31
	C-	1985-08-01 to 1986-07-31
	D-	1986-08-01 to 1987-07-31
	E-	1987-08-01 to 1988-07-31
	F-	1988-08-01 to 1989-07-31
	G-	1989-08-01 to 1990-07-31
	H-	1990-08-01 to 1991-07-31
	J-	1991-08-01 to 1992-07-31
	K-	1992-08-01 to 1993-07-31
	L-	1993-08-01 to 1994-07-31
	M-	1994-08-01 to 1995-07-31
	N-	1995-08-01 to 1996-07-31
	P-	1996-08-01 to 1997-07-31
	R-	1997-08-01 to 1998-07-31
	S-	1998-08-01 to 1999-02-28
	T-	1999-03-01 to 1999-08-31
	V-	1999-09-01 to 2000-02-29
	W-	2000-03-01 to 2000-08-31
	X-	2000-09-01 to 2001-02-28
	Y-	2001-03-01 to 2001-08-31
	-51-	2001-09-01 to 2002-02-28
	-02-	2002-03-01 to 2002-08-31
	-52-	2002-09-01 to 2003-02-28
	-03-	2003-03-01 to 2003-08-31
	-49-	2049-03-01 to 2049-08-31
	-99-	2049-09-01 to 2050-02-28


The Roman calendar counted years from the (legendary) foundation of Rome, with years AUC (ab urbe condita); this is believed to be 753 BC. Whitaker gives the tie point of 1986 AD = 2739 AUC. There was considerable confusion in the calendar until Julius Caesar had it sorted out in 46 BC, which year had 445 days. From 45 BC the calendar was essentially the Julian as used all over Europe until the change to the Gregorian at various times, as detailed above. The position of leap years is not clear to me, so I project the AD pattern back, so that leap years were 1 BC, 5 BC, &c. On this basis, the first "normal" year, 45 BC, was leap. There was more confusion after this, however, as the controllers counted every fourth year by the silly Roman inclusive system, so it was what we would call every three years. Latham gives 1 Jan 46 BC to 4 Jan 8 BC for this, then says that from 5 Jan 8 BC to 31 Dec 8 AD there were no leap years, to correct for this. There would have been leaps in 5 and 1 BC, 4 and 8 AD. If 45 BC was leap, then there should have been the following leap years before 8 BC: 41, 37, 33, 29, 25, 21, 17, 13, 9 or 9 of them; at every three years there would have been 42, 39, 36, 33, 30, 27, 24, 21, 18, 15, 12, 9 or 12 of them, so why omit 4 to correct? There is still some misunderstanding here.

The months have the same names, but the day numbering is different. The days are counted down to the next fixed point, the Nones, then the Ides, then the Kalends (first) of the next month. This count down uses the odd Roman inclusive counting, so the day before the Ides is the "Day before the Ides of March" (pridie idus Martias) and the day before that is "Third before Ides of March". The fixed days are: March, May, July, October (31 days) Kalends 1, Nones 7, Ides 15; January, August, December (31 days) Kalends 1, Nones 5, Ides 13; April, June, September, November (30 days) Kalends 1, Nones 5, Ides 13; February (28/29 days) Kalends 1, Nones 5, Ides 13. In leap years, the day 6th before Kalends of March is repeated (hence bissextile). This repeated day is the 24th by our method of counting. The repeated day was called the second (bis) 6th.

All that we need to do for the Roman calendar is to project the Julian Christian calendar back to 753 BC and change the output formatting. For years before 45 BC (709 AUC) our projection is anachronistic, except possibly for the year number. With our assumption of leap years every four years including 1 BC = 753 AUC, then years are leap when AUC%4 = 1, or in four year cycles starting with the very first year.

Key dates are:
	0001-01-01 AD = 1 Jan 754 AUC = nib-713421 (Sa)
	1 Jan 1 BC = 1 Jan 753 AUC = nib-713787 (Th)
	1 Jan 45 BC = 1 Jan 709 AUC = nib-729858 (Fr)
	1 Jan 753 BC = 1 Jan 1 AUC = nib-988455 (Tu)


The epoch is 0622-02-16 AD, which is the first day of 1 AH, from the flight (Hijrah) of the prophet Muhammad. As a checking point we also have that 1418 AH starts on 1997-05-09. The calendar runs in a cycle of 30 years. I am assuming that the first cycle is 1..30 AH, the second 31..60, and so on. On that basis we are currently in the 48th cycle from 1411..1440. Each year is common of 354 days or leap (kabishah) of 355 days. Leaps are those years where the remainder after dividing the year by 30 is one of: 2, 5, 7, 10, 13, 16, 18, 21, 24, 26 or 29. Thus there are 19 common and 11 leap years and a total of 10631 days in the 30-year cycle.

The months, with lengths, are: Muharram 30, Safar 29, Rabi I 30, Rabi II 29, Jumada I 30, Jumada II 29, Rajab 30, Shaaban 29, Ramadan 30, Shawwal 29, Dhul-Qada 30, Dhul-Hijjah 29 (common) or 30 (leap).

I know nothing about weekday names or day numbering, so for now I'm giving the western. All of this is academic anyway, as the start of each month is often proclaimed on the first actual sighting of the real moon, so can vary a day or two from the calculated dates.

Key dates here:
	0622-02-16 (Julian calendar) = nib-486405


This is all based on a calculated moon phase. This moon has a period of 29 days 12 hours 793 parts, where a part is 1/1080 hour or 3-1/3 secs. The first moon is deemed to have occurred on Sunday, September 6, -3760 in an hypothetical Gregorian calendar, projected back from the current, with a (leap) year zero. The time of this moon is Monday at 5 hours and 204 parts; bearing in mind that Hebrew days start at 18h on the previous Christian day, this puts the moon at about 23h 11m 20s on that Sunday. I think the time is at Jerusalem, which is 2h 21m ahead of UTC. This epoch Sunday is nib-2086848. The phase being calculated is new.

The months are synchronised to this moon, but to keep the annual cycle in synchronism with the seasons some years have 12 months and others 13. This pattern of leap years repeats every 19 years. In the first cycle, the first year is called AM 1, and the following years are leap: 3, 6, 8, 11, 14, 17 and 19, making 7 leap years out of 19, so 235 months per cycle. For any given year, it is leap if its remainder on division by 19 is one of these numbers (for remainder 19 read 0). Months normally alternate 30 and 29 days, with the extra leap month always being 30 days. The leap month has the same name as one of the ordinary months, Adar, which has 29 days. In leap years, the 30-day extra Adar I comes first followed by the normal Adar with 29 days and called Adar II (or various other names depending on source).

It is possible to approximate the calendar to within a day or so with just this data, starting each month on the day when the calculated moon occurs, but in practice it is much more complicated. The new year day, Rosh Hashannah, is set for each year, and starts the pattern of months according to the month lengths and the leap year rule, but this day is not allowed to be a Sunday, Wednesday or Friday, and the moon must be at least a certain bit beyond new, and other rules apply, so that it can be a day or two later than the moon would suggest. This, of course, means that the previous year must be extended to fit, and for this reason there are three lengths of common and three lengths of leap years. To fix a certain year, you have to work out the next new year and take the difference to get the length of this year. The year lengths and the pattern of month lengths for each year type are in the data.

The date of Rosh Hashannah is based on the Molad of Tishrei (calculated moon of the first month). This is found by multiplying the defined lunar period by the number of months between the epoch and the month of Tishrei for the given year and adding the Molad shel Tohu, the time of the first moon. The function 'molad()' below does this for any month. In principle, the first day which contains this time is the new year, except for these postponement rules:

1) If the Molad occurs on a Sunday, Wednesday or Friday, then Rosh Hashannah is the next day.
2) If the Molad occurs at 18h (noon) or later on a permissible day, then new year is postponed to the next permissible day (so maybe put back two days).
3) If the Molad for a common year is on Tuesday, 9 hours 204 parts or later, then new year is postponed until Thursday.
4) If the Molad following a leap year is on a Monday, 15 hours 589 parts or later, the new year is postponed to Tuesday.


There is a lot yet to be written here. Although I have implemented it, the code was ripped off from Dershowitz and Reingold and translated from Java into C, and the understanding to make a concise summary is not quite there yet.

From Wikipedia:

The traditional Chinese calendar is a lunisolar calendar which reckons years, months and days according to astronomical phenomena. It is used for traditional activities in China and overseas Chinese communities. It determines the dates of traditional Chinese holidays, and guides Chinese people in selecting the luckiest days for weddings, funerals, moving, or beginning a business.

In the Chinese calendar, the days begin and end at midnight. The months begin on the day with the dark (new) moon. The years begin with the dark moon near the midpoint between winter solstice and spring equinox. The solar terms are the important components of the Chinese calendar. There are one to three solar terms within a month.


There are Julian Day Numbers and Julian Dates. The epoch for this count is stated as 4713 BC (~= -4712 AD). This year has some numerological significance: it's where three cycles come into synch, the Julian calendar weekdays to date cycle (28 years), the golden number cycle (19 years) and some Roman tax period (15 years). For astronomical reasons, the days are assumed to begin at 12h. The civil day N begins at the midnight before the Julian day N begins at noon. I've seen it quoted as "days that have elapsed since...", which is consistent with the actual day at the epoch being zero. Some web calculators, for a given date, give day N and others give date N - 0.5. This is because for a Julian Day Number we can start with 4713 BC 1st Jan = 0 and work up, so for example today (1999-02-17 = nib+16392) is Julian Day Number 2451237. The actual Julian Date, which includes part days, is 2451236.5 at the 0h which starts this day, because the astronomical day 2451237 started at 12h today. The routine here gives the Julian Day Number, with the epoch day giving zero. The Modified Julian Date is the Julian Date less 2400000.5. This is used by astronomers, and changes integer part at midnight. For our purposes, for enumerating a day number, MJD (at 0h) = JD (at 12h) - 2400001.


This is a simple approximation, based on the figures in the 1987 Whitaker's Almanac for the average lunar cycle in solar days and the date and time of a particular new moon in April of that year. I've no idea how far away from this date the approximation is useful.


This code is ripped off from Duffet-Smith's basic code (from "Astronomy with your Personal Computer"), translated into C and made into a subroutine. It gives the time of rise and set at Milton Keynes in UTC. Milton Keynes is assumed to be at north 52 degrees 1 minute 56 seconds and west 47 minutes 42 seconds.


This code is ripped off from Duffet-Smith's basic code, translated into C by Roger Gibson. It does the Prayer Book algorithm, which I think was introduced in 1582, although the version here works only after the UK changed to the Gregorian, so the first usable year is 1752.


This was based on the Julian calendar but had its epoch on 1 Sep 5509 BC Known test point from a history of the Romanovs which said that in Russia the Byzantine year 7208 was replaced by the Julian year 1700 on 1 Jan 1700. The epoch day is nib -2725340.

That gives:
1 Sep 5509 BC = start of year 1
1 Sep 1 BC = start of year 5509
1 Sep 1 AD = start of year 5510
1 Sep 1699 AD = start of year 7208

If I've done my sums right, then Byzantine year = Julian year + 5508
+1 if Julian year is BC (negative here)
+1 if on or after 1 Sep


Lots of the data here is from Whitaker's Concise Almanac for 1997 and Whitaker's Almanac for 1987. Other sources were:
1) Hebrew Calendar Science and Myths, Remy Landau (www.geocities.com/ Athens/1584).
2) For the French Revolutionary Calendar, Reingold, Dershowitz and Clamen, Software - Practice and Experience, Vol 23(4), 383-404 (April 1993).
3) Various Web sources, inc: Kelly L Ross for Julian Day and Data.
4) Lance Latham, Standard C Date/Time Library, 1998.
5) Calendrical Calculation, Dershowitz and Reingold, 1997; also code from their website.

nib 2019-01-29 .. 2019-01-29

nigel by himself

Home + About me + E-mail me