12,761,216 members (31,557 online)
alternative version

#### Stats

15.5K views
11 bookmarked
Posted 23 Jun 2011

# Maya Calender Calculator

, 23 Jun 2011 CPOL
 Rate this:
Calculator to convert dates in Maya calendar (long counter) to Gregorian date and vice versa

## Introduction

The program is a calculator to convert dates of Maya “long counter” calendar to Gregorian calendar.

Maya long counter calendar was used by ancient Maya culture development in Mesoamerica before the arrival of Columbus 1492. Maya's culture has taken unusual interest because of supposed prophesies about the end of world in 2012 related to the end of the round of Maya long counter calendar. This calculator maybe helps to better understand these matters. You can find a lot of information about Maya on the internet.

Gregorian calendar is our actual calendar in use expressed in year, month and days.

## Background

The Mesoamerican Long Count calendar is a non-repeating, vigesimal (base-20) and base-18 calendar used by several Pre-Columbian Mesoamerican cultures, most notably the Maya. For this reason, it is sometimes known as the Maya (or Mayan) Long Count calendar.

Using a modified vigesimal tally, the Long Count calendar identifies a day by counting the number of days passed since a mythical creation date that corresponds to August 11, 3114 BCE in the Gregorian calendar.

Maya long counter is expressed in Baktun, Katun, Tun, Uinal & Kin number which program can convert to a decimal number equivalent to number of days elapsed since initial value.

In order to convert at Gregorian calendar is a little more complicated because Gregorian uses 3 values, year, month & day, and needs to take care of leap years.

The way to help in this conversion is by using Julian Day (JD. This is a calendar not commonly used by normal people, but well known by astronomers and geologists. JD is also (like Maya long counter) a continuous counter of days since January 1st 4113 BC.

Long counter and JD are values of number of days, so to convert between them, we need to know what is the value in JD when the long counter starts. This value is known as “Maya Correlation” and has been a discussion theme for Maya researchers. The value more accepted is called “Goodman Martinez Thompson” of GMT correlation and its value is JD 584.283 equivalent to August 11, 3114 BC in Gregorian calendar (proleptic).

Known correlation then the date in JD will be the long counter value plus the correlation. With date in JD then we convert JD to Gregorian data using some algorithms already known.

To convert JD to Gregorian and vice versa, the program uses the algorithm token from Wikipedia and is implemented in C# code.

## Using the Code

The core of the program is a number of routines to implement algorithms to convert between different calendars:

• `Maya2Gregorian`
• `Julian2Gregorian`
• `JulianDay2JuliaDate`
• `Gregorian2JulianDay `
• `Gregorian2Maya`

Other routines implement inputs and show results.

One example is routine `Julian2Gregorian `to convert a number of days according to Julian days (JD) to a date according to Gregorian form (years, month, day and day of the week).

The algorithm requires use of mathematic operation `mod `(module) that can be implemented by C# method `Math.DivRem`. The method executes quotient between two integers and also calculates the remainder so remainder is the same thing as the module.

Almost all operations use integers of 32 bits. Despite comments about advanced mathematics used by Maya, only operation with integers is enough.

```public void Julian2Gregorian(int JD, out int Y, out int M, out int D, out int WD)
{
/*---------------------------------------------------------------------------------
* Convert a Julian Day (JD) to Gregorian calendare
* Information from Wikipedia http://en.wikipedia.org/wiki/Julian_day
* algorithm converted to C#

* Let J = JD + 0.5: (note: this shifts the epoch back by one half day,
*                      to start it at 00:00UTC, instead of 12:00 UTC);
* let j = J + 32044; (note: this shifts the epoch back to astronomical year -4800
*                      instead of the start of the Christian era in year AD 1 of
*                      the proleptic Gregorian calendar).
* let g = j div 146097; let dg = j mod 146097;
* let c = (dg div 36524 + 1) × 3 div 4; let dc = dg ? c × 36524;
* let b = dc div 1461; let db = dc mod 1461;
* let a = (db div 365 + 1) × 3 div 4; let da = db ? a × 365;
* let y = g × 400 + c × 100 + b × 4 + a; (note: this is the integer number of full
*                      years elapsed since March 1, 4801 BC at 00:00 UTC);
* let m = (da × 5 + 308) div 153 ? 2; (note: this is the integer number of full
*                      months elapsed since the last March 1 at 00:00 UTC);
* let d = da ? (m + 4) × 153 div 5 + 122; (note: this is the number of days elapsed
*                      since day 1 of the month at 00:00 UTC,
including fractions of one day);

* let Y = y ? 4800 + (m + 2) div 12; let M = (m + 2) mod 12 + 1; let D = d + 1;
-----------------------------------------------------------------------------------*/

int j, g, c, b, a, y, m, d;
int dg, dc, db, da;

j = (int)JD + 32044;
g = Math.DivRem(j, 146097, out dg);
c = (dg / 36524 + 1) * 3 / 4;
dc = dg - (c * 36524);
b = Math.DivRem(dc, 1461, out db);
a = (db / 365 + 1) * 3 / 4;
da = db - (a * 365);
y = g * 400 + c * 100 + b * 4 + a;
m = (da * 5 + 308) / 153 - 2;
d = da - (m + 4) * 153 / 5 + 122;
Y = y - 4800 + Math.DivRem((m + 2), 12, out M);
M += 1;
D = d + 1;

Math.DivRem((int)JD, 7, out WD);
}```

## History

• June 22, 2011 - First issue

## Share

 Colombia
No Biography provided

## You may also be interested in...

 First Prev Next
 gegorian to mayan fygy4-Feb-12 15:06 fygy 4-Feb-12 15:06
 Re: gegorian to mayan eugeniothompson6-Feb-12 4:27 eugeniothompson 6-Feb-12 4:27
 I'm scared thatraja23-Jun-11 19:54 thatraja 23-Jun-11 19:54
 Fun Evoluteur23-Jun-11 15:34 Evoluteur 23-Jun-11 15:34
 Last Visit: 31-Dec-99 19:00     Last Update: 26-Feb-17 9:30 Refresh 1