Introduction
HTML provides a time element in order to mark date and time expressions in natural language. A machine readable format of this expression can be given by an attribute named datetime. The coding looks like this:
The current HTML 5 spec tells us that only precise calendar or 24 hour clock values are allowed, but the HTML 5.1 draft extends it pretty much: month strings, yearless date strings, week strings, time strings without date and duration strings shoud be allowed.
The datetime attribute allows for proleptic Gregorian dates only (the 5.1 draft skips this). Proleptic means that a year 0 exists since this simplifies calendar math. The purpose of my script is to provide access to calendars from CPAN, a code respository for Perl programmers, in order to calculate machine readable expressions for all available calendars. Time can only get processed if the module provides an interface to a 24 hour clock – a few of those based on the DateTime class do. Day counting modules take the time via the fractional part.
Strangely years are restricted to positive numbers in the HTML spec. This wipes out the main advantage of having a proleptic calendar, whereas the underlying ISO 8601 format allows for them and Perl’s DateTime::Format::W3CDTF formatter returns them without difficulty. I suppose that historians and other people of that type should adopt it and simply wait until the error becomes a standard. But be aware that this might run into problems with JavaScript accessing such objects!
And finally a crucial warning: Please take care that all your inputs build a legal date in the referring calendar. Not all modules are save from nonsens values like 30. February in the Gregorian and throw an error! If that or simply nothing happens, the date was illegal or the module is out of range. Furthermore not all modules are speed optimized and will noticeably delay with dates far away from their real use.
Calendar form
Algorithm sources
Clicking the links will lead you to the module’s documentation on CPAN, which is sometimes pretty sloppy. I had to browse the code frequently.
The main sources behind the Perl modules are the books by Richard Graham, 1 Reingold and Dershowitz, 2 and the CALPAK library by John Burkardt.
Europe
Gregorian
Julian
DateTime::Calendar::Julian module
Roman
We use the Date::Roman module merely not as calendar of its own but as formatter only. The documentation says that the shift from Julian to Gregorian calendar is implemeted but I cannot see that this has an effect for conversion from Roman to Christian. That’s why I simply ask for it. The irregular leap years between 45 BC (709 AUC) and 7 AD (760 AUC) are not implemented and years ante urba condita are not allowed.
Macedonian
Republican (French revolutionary)
DateTime::Calendar::FrenchRevolutionary module
Africa and Near East
Islamic (Hijri)
Hebrew
DateTime::Calendar::Hebrew module
Persian
Zoroastrian
Coptic
Ethiopian
Alexandrian
Syrian
Armenian
India
Saka (Indian national)
Tamil (Hindu solar)
Halari Samvata
DateTime::Calendar::HalariSamvata module
Shalivahana Shaka
DateTime::Calendar::ShalivahanaShaka::Southern module. This module shows remarkable delays and it failed to install on a Windows computer. I am a bit puzzled about that since it shares most of its code with the HalariSamvata and VikramaSamvata::Gujarati modules which never caused any problems to me. If I observe too much server load I have to switch it off.
Vikrama Samvata (Gujarati)
DateTime::Calendar::VikramaSamvata::Gujarati module
Bahá’í
Far East and America
Chinese
Employs Calendar::Any::Chinese. Minimum date is 59th year of cycle 44.
Japanese
Sorry, I cannot provide it since DateTime::Calendar::Japanese failed to install on my server.
Maya (long count)
DateTime::Calendar::Mayan module
Satirical calendars
If you have never heard of ‘Pataphysics
or Discordianism
don’t mind. I did not either.
Discordian
DateTime::Calendar::Discordian module
Pataphysical
DateTime::Calendar::Pataphysical module
Day count
Rata die
DateTime::Format::Epoch::RataDie module
Julian Day number
DateTime::Format::Epoch::JD module; not to interfere with the Julian calendar. It is the usual format in astronomy.
Modified Julian Day number
DateTime::Format::Epoch::MJD module
Reduced Julian Day number
DateTime::Format::Epoch::RJD module
Truncated Julian Day number
DateTime::Format::Epoch::TJD module
Lilian count
DateTime::Format::Epoch::Lilian module; named after Italian scientist Aloisius Lilius (1510–1576) who prepared the Gregorian reform but introduced by IBM 1986 and counts the days since 15 October 1582.
Notes
1Richard Graham: Mapping Time: The Calendar and Its History. Oxford, New York (Oxford University Press) 1998, ISBN 0192862057.
2Nachum Dershowitz, Edward M. Reingold: Calendrical Calculations. Cambridge, New York, Melbourne (Cambridge University Press), 3rd edition: 2008, ISBN 9780521885409.