DateTim...r::Mayan(3)
okay bestie, welcome to the manual page for DateTime::Calendar::Mayan β thatβs the Perl module for the Mayan Long Count, Haab, and Tzolkin calendars. This is User Contributed Perl Documentation, and weβre gonna go through every little thing together, no cap. β¨
π NAME π
DateTime::Calendar::Mayan β The Mayan Long Count, Haab, and Tzolkin calendars
π¦ SYNOPSIS π¦
okay so hereβs the vibe, bestie:
use DateTime::Calendar::Mayan
my $dtcm = DateTime::Calendar::Mayan->new(
baktun => 12,
katun => 19,
tun => 10,
uinal => 2,
kin => 8,
# alternate epoch
epoch => DateTime->new(
year => -3113,
month => 8,
day => 13,
),
);
print $dtcm->date;
# prints 12.19.10.2.8
print $dtcm->haab;
# prints 3 Uayeb
print $dtcm->tzolkin;
# prints 3 Oc
πΈ DESCRIPTION πΈ
An implementation of the Mayan Long Count, Haab, and Tzolkin calendars as defined in "Calendrical Calculations The Millennium Edition". Supplemented by "Frequently Asked Questions about Calendars". π«
β¨ METHODS β¨
new( baktun => $scalar, ..., epoch => $object )β Accepts a hash representing a date on the Long Count calendar and aDateTime::Calendarobject specifying an alternate epoch. All keys are optional.
The units are:
kin= 1 dayuinal= 20 daystun= 360 dayskatun= 7200 daysbaktun= 144000 days
In the future pictuns, calabtuns, kinchiltuns, and alautuns may be accepted. π
nowβ Alternate constructor. UsesDateTime->nowto set the current date.todayβ Alternate constructor. UsesDateTime->todayto set the current date.cloneβ This object method returns a replica of the given object.from_object( object => $object )β Accepts aDateTime::Calendarobject. Although this calendar doesn't support time it will preserve the time value of objects passed to it. This prevents a loss of precision when chaining calendars.
Note: Language support is not implemented. π«Ά
utc_rd_valuesβ Returns the current UTC Rata Die days, UTC Rata Die seconds, and nanoseconds as a three element list.from_epoch( epoch => $scalar )β Creates a new object from a number of seconds relative to midnight 1970-01-01.epochβ Returns the number of seconds since midnight 1970-01-01.set_mayan_epoch( object => $object )β Accepts aDateTime::Calendarobject. The epoch is set to this value on a per object basis.
The default epoch is:
Goodman-Martinez-Thompson
Aug. 11, -3113 / Sep. 6, 3114 B.C.E. / 584,283 JD
mayan_epochβ Returns aDateTime::Calendar::Mayanobject set to the current Mayan epoch.dateβ listed as a method; the original page gives no extra description here.bktukβ listed exactly asbktuk; the original page gives no extra description here. (yes, that spelling is on purpose, bestie π )long_count( $scalar )β Returns the Long Count calendar date. ThinkDateTime::ymd. Likeymdthis method also accepts an optional field separator string.haab( $scalar )β Returns the Haab calendar date. Accepts an optional field separator string.tzolkin( $scalar )β Returns the Tzolkin calendar date. Accepts an optional field separator string.baktunβ Gets/Sets the long count value of the function name.katunβ Gets/Sets the long count value of the function name.tunβ Gets/Sets the long count value of the function name.uinalβ Gets/Sets the long count value of the function name.kin( $scalar )β Gets/Sets the long count value of the function name.set_baktunβ alias to the combined accessor/mutator.set_katunβ alias to the combined accessor/mutator.set_tunβ alias to the combined accessor/mutator.set_uinalβ alias to the combined accessor/mutator.set_kin( $scalar )β Aliases to the combined accessor/mutators.set( baktun => $scalar, ... )β Accepts a hash specifying new long count values. All units are optional.addβ listed as a method alongsidesubtract.subtract( baktun => $scalar, ... )β Accepts a hash specifying values to add or subject from the long count. All units are optional. (yes, it says βsubjectβ in the original β preserving the lore fr fr π)add_durationβ listed as a method alongsidesubtract_duration.subtract_duration( $object )β Accepts aDateTime::Durationobject and either adds or subtracts it from the current date. See theDateTime::Durationdocs for more details.
π BACKGROUND π
Please see:
Chapter 10 of Calendarical Calculations "The Millennium Edition".
and
Chapter 7 of Frequently Asked Questions about Calendars. http://www.tondering.dk/claus/cal/node8.html
β οΈ GOTCHAS β οΈ
The Long Count calendar is cyclical and it is possible to have different dates in other calendars that convert to be the same Long Count date.
Under this calendar the dates0.0.0.0.0and13.0.0.0.0are equivalent. π
The Long Count calendar will next roll over in late 2012 (Gregorian). In anticipation of this Long Count dates input as 0-12.*.*.*.* will convert to Gregorian dates in the Mayan year that started in -3113 (Gregorian). Long Count dates input as 13.*.*.*.* will convert to Gregorian dates in the Mayan year that start in 2012 (Gregorian).
Example:
use DateTime;
use DateTime::Calendar::Mayan;
my $dtcm = DateTime::Calendar::Mayan->new( baktun => 0 );
print $dtcm->date, "\n";
print DateTime->from_object( object => $dtcm )->ymd, "\n";
$dtcm->set( baktun => 13);
print $dtcm->date, "\n";
print DateTime->from_object( object => $dtcm )->ymd, "\n";
Will print:
13.0.0.0.0
-3113-08-11
13.0.0.0.0
2012-12-21
As you can see the Long Count dates are identical but the Gregorian equivalent dates are different.
Support for a count of Mayan "years" or "cycles" allowing accurate conversion to/from Gregorian dates may be added to this module in the future. This would be an extension to the historical Long Count calendar. π¦
π«Ά CREDITS π«Ά
- Dave Rolsky (DROLSKY) for the DateTime project and carrying us this far.
- Eugene van der Pijll (PIJLL) for
DateTime::Calendar::Julianwhich I looked at more then once. Calendrical Calculations "The Millennium Edition"By Edward M. Reingold & Nachum Dershowitz. (ISBN 0-521-77752-6 paperback)http://www.calendarists.com- Abigail (ABIGAIL) for
Date::Mayafrom which I confirmed the algorithm for Mayan years. "Frequently Asked Questions about Calendars"by Claus TΓΈndering.http://www.tondering.dk/claus/calendar.html
π SUPPORT π
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
π AUTHOR π
Joshua Hoblitt <jhoblitt@cpan.org>
π COPYRIGHT π
Copyright (c) 2003 Joshua Hoblitt. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
π₯ SEE ALSO π₯
datetime@perl.org mailing list
mwah π thatβs the whole page, bestie! signed off from perl v5.42.0 on 2024-03-04, for DateTim...r::Mayan(3). go forth and convert calendars like the main character you are. π«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-DateTime-Calendar-Mayan 0.0601-bp160.2.11 Β· Artistic-1.0
- opensuse-leap 16.0: perl-DateTime-Calendar-Mayan 0.0601-bp160.2.11 Β· Artistic-1.0
- opensuse-leap 16.0: perl-DateTime-Calendar-Mayan 0.0601-bp160.2.11 Β· Artistic-1.0
- opensuse-leap 16.0: perl-DateTime-Calendar-Mayan 0.0601-bp160.2.11 Β· Artistic-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms