By default, the time.fromCalendar function makes a transition from the old Julian calendar to the new Gregorian calendar at midnight on 14th September 1752 (Gregorian calendar), when Britain and the British Empire switched calendars. Thus, dates between 2nd September and 14th September 1752 are not valid input dates, since they days never occurred in the British calendar.
This behaviour may be changed using the set calendar command, which offers a choice of nine different calendars listed in Table 4.2. Most of the these calendars differ only in the date on which the transition is made between the old (Julian) calendar and the new (Gregorian) calendar.
The exceptions are the Hebrew and Islamic calendars, which have entirely different systems of months.
Calendar |
Description |
British |
Use the Gregorian calendar from 14th September 1752 (Gregorian), and the Julian calendar prior to 2nd September 1752 (Julian). |
French |
Use the Gregorian calendar from 20th December 1582 (Gregorian), and the Julian calendar prior to 9th December 1582 (Julian). |
Greek |
Use the Gregorian calendar from 1st March 1923 (Gregorian), and the Julian calendar prior to 15th February 1923 (Julian). |
Gregorian |
Use the Gregorian calendar for all dates. |
Hebrew |
Use the Hebrew (Jewish) calendar. |
Islamic |
Use the Islamic (Muslim) calendar. Note that the Islamic calendar is undefined prior to 1st Muharram AH 1, corresponding to 18th July AD 622. |
Julian |
Use the Julian calendar for all dates. |
Papal |
Use the Gregorian calendar from 15th October 1582 (Gregorian), and the Julian calendar prior to 4th October 1582 (Julian). |
Russian |
Use the Gregorian calendar from 14th February 1918 (Gregorian), and the Julian calendar prior to 31st January 1918 (Julian). |
Optionally, the set calendar command can be used to set different calendars to use when converting calendar dates into date objects, and when converting in the opposite direction. This is useful when converting data from one calendar to another. The syntax used to do this is as follows:
set calendar in Julian # only applies to time.fromCalendar() set calendar out Gregorian # does not apply to time.fromCalendar() set calendar in Julian out Gregorian # change both show calendar # show calendars currently being used
The Russian novelist Leo Tolstoy was born on 28th August pyxplot> set calendar in russian out british
and died on 7th November
in the Russian calendar. What dates do these correspond to in the Western calendar?
pyxplot> birth = time.fromCalendar(1828, 8,28,12,0,0)
pyxplot> death = time.fromCalendar(1910,11, 7,12,0,0)
pyxplot> print birth
Tue 1828 Sep 9 12:00:00 UTC
pyxplot> print death
Sun 1910 Nov 20 12:00:00 UTC