Date::Maya -- Translate between Julian days and Maya days.
use Date::Maya; my $long_count = julian_to_maya 2451432; my ($long, $tzolkin, $haab) = julian_to_maya 2451432; my $julian = maya_to_julian '126.96.36.199.9';
For an extensive description of both the Maya calendar and Julian days, see the calendar faq .
This module presents routines to calculate the Mayan day from a Julian day, and a Julian day from a Mayan day. The Mayan calendar has different dating systems, the Long Count (which cycles every 5125 years), the Tzolkin (260 days) and the Haab (365 days). The Long Count consists of quintuple of numbers (really a mixed base 20/18 number), while the Tzolkin and the Haab consist of day numbers and week or month names. In the Tzolkin, both the week number and week name change from day to day; the week number cycles through 1 to 13, while there are 20 week names to cycle through. This gives a period of 260 days. The Haab has 18 months, of each 20 days, numbered 0 to 19. A new month is only started after reaching day 19. At the end of the 360 days, there are 5 Uayeb days. In the Long Count, all the numbers of the quintuple are 0 to 19 or 0 to 17, except the first, (the number of baktuns), which goes from 1 to 13; with 13 serving as 0.
By default, Date::Maya exports two subroutines,
julian_to_maya takes a Julian day as argument, and returns the Long Count date in scalar context. In list context, it returns the Long Count date, the Tzolkin date, and the Haab date.
maya_to_julian takes a Long Count date as argument, and returns a Julian day.
It is unclear when the epoch of the Mayan calendar occurred. Three dates are mentioned as candidates, 13 Aug 3114 BC, 11 Aug 3114 BC, and 15 Oct 3374 BC. Unless changed, this module assumes 13 Aug 3114 as the epoch.
To change the epoch, import the function
maya_epoch, and call it with the Julian date that should be the epoch. Constants
MAYA_EPOCH3 can be imported, which will have the Julian days for 13 Aug 3114 BC, 11 Aug 3114 BC, and 15 Oct 3374 BC as values. The three constants can be imported at once by using the
The Mayan calendar is cyclic, with a period of just over 5125 years. This means that if the epoch was in Aug 3114 BC, the calendar will roll over in Dec 2012 AD. If the epoch was in 3374 BC, the roll over has occured over 200 years ago. Since the calendar is cyclic, the
maya_to_julian function is not unique. We will however return only one date, and that is the first Julian day matching the Long Count date on or after the choosen epoch.
The Mayan Long Count calendar rolls over after 1872000 days.
Tondering, Claus: FREQUENTLY ASKED QUESTIONS ABOUT CALENDARS http://www.tondering.dk/claus/calendar.html
Sources are on github: git://github.com/Abigail/date--maya.git.
DateTime::Calendar::Mayan is a plugin for the
This package was written by Abigail, mailto:firstname.lastname@example.org.
This package is copyright 1999 - 2009 by Abigail.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.