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:

1 <!-- HTML 5 time element example: --> 2 <time datetime="2010-12-25T20:00:00+09:00">Xmas dinner in Tokyo</time> 3 4 <!-- The clock time can be skipped: --> 5 <time datetime="2010-12-25">Xmas</time>

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.

Table of contents

Calendar form

Select calendar

Table of contents

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

DateTime module

Table of contents

Julian

DateTime::Calendar::Julian module

Table of contents

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.

Table of contents

Macedonian

Date::Converter module

Table of contents

Republican (French revolutionary)

DateTime::Calendar::FrenchRevolutionary module

Table of contents

Africa and Near East

Islamic (Hijri)

Calendar::Hijri module

Table of contents

Hebrew

DateTime::Calendar::Hebrew module

Table of contents

Persian

Calendar::Persian module

Table of contents

Zoroastrian

Date::Converter module

Table of contents

Coptic

Date::Converter module

Table of contents

Ethiopian

Date::Converter module

Table of contents

Alexandrian

Date::Converter module

Table of contents

Syrian

Date::Converter module

Table of contents

Armenian

Date::Converter module

Table of contents

India

Saka (Indian national)

Calendar::Saka module

Table of contents

Tamil (Hindu solar)

Date::Converter module

Table of contents

Halari Samvata

DateTime::Calendar::HalariSamvata module

Table of contents

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.

Table of contents

Vikrama Samvata (Gujarati)

DateTime::Calendar::VikramaSamvata::Gujarati module

Table of contents

Bahá'í

Date::Converter module

Table of contents

Far East and America

Chinese

Employs Calendar::Any::Chinese. Minimum date is 59th year of cycle 44.

Table of contents

Japanese

Sorry, I cannot provide it since DateTime::Calendar::Japanese failed to install on my server.

Table of contents

Maya (long count)

DateTime::Calendar::Mayan module

Table of contents

Satirical calendars

If you have never heard of 'Pataphysics or Discordianism don't mind. I did not either.

Discordian

DateTime::Calendar::Discordian module

Table of contents

Pataphysical

DateTime::Calendar::Pataphysical module

Table of contents

Day count

Rata die

DateTime::Format::Epoch::RataDie module

Table of contents

Julian Day number

DateTime::Format::Epoch::JD module; not to interfere with the Julian calendar. It is the usual format in astronomy.

Table of contents

Modified Julian Day number

DateTime::Format::Epoch::MJD module

Table of contents

Reduced Julian Day number

DateTime::Format::Epoch::RJD module

Table of contents

Truncated Julian Day number

DateTime::Format::Epoch::TJD module

Table of contents

Lilian count

DateTime::Format::Epoch::Lilian module; named after Italian scientist Aloisius Lilius () who prepared the Gregorian reform but introduced by IBM and counts the days since .

Table of contents


Notes

1: Mapping Time: The Calendar and Its History. Oxford, New York (Oxford University Press) , ISBN 0192862057.

2, : Calendrical Calculations. Cambridge, New York, Melbourne (Cambridge University Press), 3rd edition: , ISBN 9780521885409.

words, ≈ characters