1DateTime::Calendar::MayUasne(r3)Contributed Perl DocumenDtaatteiToinme::Calendar::Mayan(3)
2
3
4
6 DateTime::Calendar::Mayan - The Mayan Long Count, Haab, and Tzolkin
7 calendars
8
10 use DateTime::Calendar::Mayan
11
12 my $dtcm = DateTime::Calendar::Mayan->new(
13 baktun => 12,
14 katun => 19,
15 tun => 10,
16 uinal => 2,
17 kin => 8,
18 # alternate epoch
19 epoch => DateTime->new(
20 year => -3113,
21 month => 8,
22 day => 13,
23 ),
24 );
25
26 print $dtcm->date;
27 # prints 12.19.10.2.8
28 print $dtcm->haab;
29 # prints 3 Uayeb
30 print $dtcm->tzolkin;
31 # prints 3 Oc
32
34 An implementation of the Mayan Long Count, Haab, and Tzolkin calendars
35 as defined in "Calendrical Calculations The Millennium Edition".
36 Supplemented by "Frequently Asked Questions about Calendars".
37
39 • new( baktun => $scalar, ..., epoch => $object )
40
41 Accepts a hash representing a date on the Long Count calendar and a
42 "DateTime::Calendar" object specifying an alternate epoch. All
43 keys are optional.
44
45 The units are:
46 kin = 1 day
47 uinal = 20 days
48 tun = 360 days
49 katun = 7200 days
50 baktun = 144000 days
51
52 In the future pictuns, calabtuns, kinchiltuns, and alautuns may be
53 accepted.
54
55 • now
56
57 Alternate constructor. Uses DateTime->now to set the current date.
58
59 • today
60
61 Alternate constructor. Uses DateTime->today to set the current
62 date.
63
64 • clone
65
66 This object method returns a replica of the given object.
67
68 • from_object( object => $object )
69
70 Accepts a "DateTime::Calendar" object. Although this calendar
71 doesn't support time it will preserve the time value of objects
72 passed to it. This prevents a loss of precision when chaining
73 calendars.
74
75 Note: Language support is not implemented.
76
77 • utc_rd_values
78
79 Returns the current UTC Rata Die days, UTC Rata Die seconds, and
80 nanoseconds as a three element list.
81
82 • from_epoch( epoch => $scalar )
83
84 Creates a new object from a number of seconds relative to midnight
85 1970-01-01.
86
87 • epoch
88
89 Returns the number of seconds since midnight 1970-01-01.
90
91 • set_mayan_epoch( object => $object )
92
93 Accepts a "DateTime::Calendar" object. The epoch is set to this
94 value on a per object basis
95
96 The default epoch is:
97
98 Goodman-Martinez-Thompson
99 Aug. 11, -3113 / Sep. 6, 3114 B.C.E. / 584,283 JD
100
101 • mayan_epoch
102
103 Returns a "DateTime::Calendar::Mayan" object set to the current
104 Mayan epoch.
105
106 • date
107
108 • bktuk
109
110 • long_count( $scalar )
111
112 Returns the Long Count calendar date. Think DateTime::ymd. Like
113 ymd this method also accepts an optional field separator string.
114
115 • haab( $scalar )
116
117 Returns the Haab calendar date. Accepts an optional field
118 separator string.
119
120 • tzolkin( $scalar )
121
122 Returns the Tzolkin calendar date. Accepts an optional field
123 separator string.
124
125 • baktun
126
127 • katun
128
129 • tun
130
131 • uinal
132
133 • kin( $scalar )
134
135 Gets/Sets the long count value of the function name.
136
137 • set_baktun
138
139 • set_katun
140
141 • set_tun
142
143 • set_uinal
144
145 • set_kin( $scalar )
146
147 Aliases to the combined accessor/mutators.
148
149 • set( baktun => $scalar, ... )
150
151 Accepts a hash specifying new long count values. All units are
152 optional.
153
154 • add
155
156 • subtract( baktun => $scalar, ... )
157
158 Accepts a hash specifying values to add or subject from the long
159 count. All units are optional.
160
161 • add_duration
162
163 • subtract_duration( $object )
164
165 Accepts a "DateTime::Duration" object and either adds or subtracts
166 it from the current date. See the DateTime::Duration docs for
167 more details.
168
170 Please see:
171
172 Chapter 10 of Calendarical Calculations "The Millennium Edition".
173
174 and
175
176 Chapter 7 of Frequently Asked Questions about Calendars.
177 http://www.tondering.dk/claus/cal/node8.html
178
180 The Long Count calendar is cyclical and it is possible to have
181 different dates in other calendars that convert to be the same Long
182 Count date. Under this calendar the dates 0.0.0.0.0 and 13.0.0.0.0 are
183 equivalent.
184
185 The Long Count calendar will next roll over in late 2012 (Gregorian).
186 In anticipation of this Long Count dates input as 0-12.*.*.*.* will
187 convert to Gregorian dates in the Mayan year that started in -3113
188 (Gregorian). Long Count dates input as 13.*.*.*.* will convert to
189 Gregorian dates in the Mayan year that start in 2012 (Gregorian).
190
191 Example:
192
193 use DateTime;
194 use DateTime::Calendar::Mayan;
195
196 my $dtcm = DateTime::Calendar::Mayan->new( baktun => 0 );
197 print $dtcm->date, "\n";
198 print DateTime->from_object( object => $dtcm )->ymd, "\n";
199
200 $dtcm->set( baktun => 13);
201 print $dtcm->date, "\n";
202 print DateTime->from_object( object => $dtcm )->ymd, "\n";
203
204 Will print:
205
206 13.0.0.0.0
207 -3113-08-11
208 13.0.0.0.0
209 2012-12-21
210
211 As you can see the Long Count dates are identical but the Gregorian
212 equivalent dates are different.
213
214 Support for a count of Mayan "years" or "cycles" allowing accurate
215 conversion to/from Gregorian dates may be added to this module in the
216 future. This would be an extension to the historical Long Count
217 calendar.
218
220 Dave Rolsky (DROLSKY) for the DateTime project and carrying us this
221 far.
222
223 Eugene van der Pijll (PIJLL) for DateTime::Calendar::Julian which I
224 looked at more then once.
225
226 Calendrical Calculations "The Millennium Edition" By Edward M. Reingold
227 & Nachum Dershowitz. (ISBN 0-521-77752-6 paperback)
228 http://www.calendarists.com
229
230 Abigail (ABIGAIL) for Date::Maya from which I confirmed the algorithm
231 for Mayan years.
232
233 "Frequently Asked Questions about Calendars" by Claus Tondering.
234 http://www.tondering.dk/claus/calendar.html
235
237 Support for this module is provided via the datetime@perl.org email
238 list. See http://lists.perl.org/ for more details.
239
241 Joshua Hoblitt <jhoblitt@cpan.org>
242
244 Copyright (c) 2003 Joshua Hoblitt. All rights reserved. This program
245 is free software; you can redistribute it and/or modify it under the
246 same terms as Perl itself.
247
248 The full text of the license can be found in the LICENSE file included
249 with this module.
250
252 datetime@perl.org mailing list
253
254 http://datetime.perl.org/
255
256
257
258perl v5.32.1 2021-01-27 DateTime::Calendar::Mayan(3)