The Aztec calendar was an adaptation of the Mayan calendar. Both consist of a 365-day agricultural calendar, as well as a 260-day sacred calendar.
The Aztecs attributed the invention of the calendar to the God Quetzalcoatl. It is based on mathematical formulas which the whole universe is organized to, and to which govern the actions of both Gods and men. The calendar actually consists of two: the Xiupohualli or the count of the days and the Tonalpohualli or the count of destiny.
The calendar was consulted through the priests before engaging in any activity whether it was farming, warfare, religion or commerce. In addition, it also provides astronomical data like the phases of the moon, Venus and the years of Mercury and Mars.
It also mentions the four eras of humanity known as "suns" before our own which all ended in cataclysm. The sun that is now ours, the fifth one, Nahui Ollin, four earthquake, is supposed to end by cataclysmic earthquakes.