Buddhist calendar
The Buddhist calendar is a set of lunisolar calendars primarily used in Cambodia, Laos, Myanmar, India, Sri Lanka, and Thailand as well as in Malaysia, Singapore and Vietnam by Chinese populations for religious or official occasions. While the calendars share a common lineage, they also have minor but important variations such as intercalation schedules, month names and numbering, use of cycles, etc. In Thailand, the name Buddhist Era is a year numbering system shared by the traditional Thai lunisolar calendar and by the Thai solar calendar. The Southeast Asian lunisolar calendars are largely based on an older version  of the Hindu calendar, which uses the sidereal year as the solar year. One major difference is that the Southeast Asian systems, unlike their Indian cousins, do not use apparent reckoning to stay in sync with the sidereal year. Instead, they employ their versions of the Metonic cycle. However, since the Metonic cycle is not very accurate for sidereal years, the Southeast Asian calendar is slowly drifting out of sync with the sidereal, approximately one day every 100 years. Yet no coordinated structural reforms of the lunisolar calendar have been undertaken. Today, the traditional Buddhist lunisolar calendar is used mainly  for Theravada Buddhist festivals. The Thai Buddhist Era, a renumbered Gregorian calendar, is the official calendar in Thailand. Structure. The calculation methodology of the current versions of Southeast Asian Buddhist calendars is largely based on that of the Burmese calendar, which was in use in various Southeast Asian kingdoms down to the 19th century under the names of Chula Sakarat and Jolak Sakaraj. The Burmese calendar in turn was based on the "original" "Surya Siddhanta" system of ancient India (believed to be Ardharatrika school). One key difference with Indian systems is that the Burmese system has followed a variation of  the Metonic cycle. It is unclear from where, when or how the Metonic system was introduced; hypotheses range from China to Europe. The Burmese system, and indeed the Southeast Asian systems, thus use a "strange" combination of sidereal years from Indian calendar in combination with the Metonic cycle better for tropical years. Epochal date. In all Theravada traditions, the calendar's epochal year 0 date was the day in which the Buddha attained "parinibbāna". However, not all traditions agree on when it actually took place. In Burmese Buddhist tradition, it was 13 May 544 BCE (Tuesday, Full moon of Kason  148 Anjanasakaraj). But in Thailand, it was 11 March 545 BCE, the date which the current Thai lunisolar and solar calendars use as the epochal date. Yet, the Thai calendars for some reason have fixed the difference between their Buddhist Era (BE) numbering and the Christian/Common Era (CE) numbering at 543, which points to an epochal year of 544 BCE, not 545 BCE. In Myanmar, the difference between BE and CE can be 543 or 544 for CE dates, and 544 or 543 for BCE dates, depending on the month of the Buddhist Era (as the Buddhist calendar straddles  the Gregorian calendar—currently from April to April). Month. Types. The calendar recognizes two types of months: synodic month and sidereal month. The Synodic months are used to compose the years while the 27 lunar sidereal days (Sanskrit: "nakshatra"), alongside the 12 signs of the zodiac, are used for astrological calculations. (The Burmese calendar also recognizes a solar month called "Thuriya Matha", which is defined as 1/12th of a year. But the solar month varies by the type of year such as tropical year, sidereal year, etc.) Waxing and waning. The days of the month are counted in two halves , waxing and waning. The 15th of the waxing is the civil full moon day. The civil new moon day is the last day of the month (14th or 15th waning). Because of the inaccuracy of the calendrical calculation systems, the mean and real (true) New Moons rarely coincide. The mean New Moon often precedes the real New Moon. Number of days per month. As the Synodic lunar month is approximately 29.5 days, the calendar uses alternating months of 29 and 30 days. Month numbering. Various regional versions of Chula Sakarat/Burmese calendar existed across various regions of mainland Southeast Asia . Unlike Burmese systems, Kengtung, Sipsongpanna, Lan Na, Lan Xang and Sukhothai systems refer to the months by numbers, not by names. This means reading ancient texts and inscriptions in Thailand requires constant vigilance, not just in making sure one is correctly operating for the correct region, but also for variations within regions itself when incursions cause a variation in practice. Year. The Buddhist calendar is a lunisolar calendar in which the months are based on lunar months and years are based on solar years. One of its primary objectives is to synchronize the lunar part with the solar part. The  lunar months, normally twelve of them, consist alternately of 29 days and 30 days, such that a normal lunar year will contain 354 days, as opposed to the solar year of ~365.25 days. Therefore, some form of addition to the lunar year (of intercalation) is necessary. The overall basis for it is provided by cycles of 57 years. Eleven extra days are inserted in every 57 years, and seven extra months of 30 days are inserted in every 19 years (21 months in 57 years). This provides 20819 complete days to both calendars. This 57-year cycle would provide a  mean year of about 365.2456 days and a mean month of about 29.530496 days, if not corrected. As such, the calendar adds an intercalary month in leap years and sometimes also an intercalary day in great leap years. The intercalary month not only corrects the length of the year but also corrects the accumulating error of the month to extent of half a day. The average length of the month is further corrected by adding a day to Nayon at irregular intervals—a little more than seven times in two cycles (39 years). The intercalary day is never inserted except  in a year which has an intercalary month. The Hindu calendar inserts an intercalary month at any time of year as soon as the accumulated fractions amount to one month. The Burmese calendar however always inserts the intercalary month at the same time of the year, after the summer solstice while the Arakanese calendar inserts it after the vernal equinox. Burmese. The Burmese calendar year consists of 354, 384 or 385 days. Note: The Arakanese calendar adds the intercalary day in Tagu, not in Nayon. Cambodian, Lao and Thai. The Cambodian, Lao and Thai lunisolar calendars use a slightly different  method to place the intercalary day. Instead of it in a leap year as in the Burmese system, the Thai system places it in a separate year. Thus, the Thai small leap year has 355 days while the Thai great leap year has 384 days. New Year's Day. Since the main purpose of Buddhist calendar is to keep pace with the solar year, the new year is always marked by the solar year, which falls at the time when the Sun enters Aries. The date, which at the present falls on the 17th of April, has slowly drifted over  the centuries. In the 20th century, the New Year's Day fell on April 15 or 16th but in the 17th century, it fell on April 9 or 10th. Thailand and Cambodia no longer use the traditional lunisolar calendar to mark the New Year's Day. Cycle. The Cambodian, Lao and Thai systems give animal names to the years from a cycle of 12. The practice also existed in Burma in the Pagan period but later died out. The Cambodian calendar also maintains a 10-year naming cycle (numbered one to ten). Cambodians use multiple systems to identify a given  year. For instance, 2017 is identified as 2561 Buddhist Era, the year of Rooster, Nuppasak (Year 9). The Thai lunar calendar also uses a similar numbered 10-year cycle. Each number in the cycle corresponds to the last digit of the year in the "Chula Sakarat" calendar. Accuracy. The Southeast Asian Buddhist calendars use lunar months but try to keep pace with the solar year, by inserting intercalary months and days on the Metonic cycle (in the case of the Burmese calendar, on a modified Metonic cycle). However, the solar year as defined by the Buddhist calendars is really a  sidereal year, which is nearly 24 minutes longer than the actual mean tropical year. Therefore, like all sidereal-based calendars, the lunisolar calendars are slowly drifting away from the seasons. The calendars are drifting one day approximately every 60 years and 4 months. The accumulating drift against the seasons means the New Year's Day which used to fall on 22 March (near the vernal equinox) in 638 CE now falls on 17 April in 2013 CE. There is no known internationally concerted effort to stop this drift. Thailand has moved its "Buddhist Era" to the Gregorian calendar under the  name of Thai solar calendar. In Myanmar, Burmese calendarists have tried to deal with the issue by periodically modifying the intercalation schedule in the Metonic cycle. One major downside of this approach is that it is not possible to publish future calendars more than a few years (often even a year) ahead. History. The Buddhist Era was first introduced to Southeast Asia along with Buddhism in the early centuries CE. It was not a separate calendar but simply a year numbering system that employed the organization and calculation methods of the prevailing lunisolar calendars in use throughout the region. In  the early centuries CE, the reference civil calendar of the Buddhist calendar prevalent in Southeast Asia was the Saka Era (Mahāsakaraj Era), which is said to have been adopted by the Pyu state of Sri Ksetra in 80 CE. The Saka Era was gradually replaced by the Burmese Era or Culāsakaraj, first in Myanmar in 640 CE, and in other Theravada kingdoms of Southeast Asia between the 13th and 16th centuries. Theravada Buddhist tradition also recognizes pre-Buddhist Anjana Sakaraj (Añjana's Era) since the events of the Buddha's life are recorded in that era. The tradition of using  different reference calendars continued in Siam in 1912 when King Vajiravudh decreed that the Buddhist Era would now track the Thai solar calendar, the Siamese version of the Gregorian calendar with the New Year's Day of 1 April. Therefore, the Thai Buddhist Era year of 2455 began on 1 April 1912 (as opposed to 15 April 1912 according to the lunisolar calendar). The Thai Buddhist Era was further realigned to the Gregorian calendar on 6 September 1940 when Prime Minister Phibunsongkhram decreed 1 January 1941 as the start of the year 2484 BE. As a result, the Year 2483  was only 9 months long, and the Thai Buddhist Era equals that of the Common Era plus 543 years. Current usage. The lunisolar calendar is used to mark important Buddhist holidays. Many of the holidays are celebrated as public holidays. Computer support. The Thai-style "Buddhist calendar", which is the Gregorian calendar with the Buddhist era, is supported in Java 8, iOS, and macOS.