# Khmer Calendar Algorithm

The following calculation is from "Pratitin Soryakkatik-Chankatik 1900-1999" by Mr. Roath Kim Soeun. It illustrates how to determine if a given year is a normal year, leap-day year, or leap-month year. The calculation can use different eras including Buddhist Era, Jola Sakaraj but not AD. Here we choose to use only Buddhist Era.

## Calculation

The calculation here is concerned with determining if a given year is a normal Lunisolar year (354 days), or leap-day year (355 days) or a leap-month year (384 days).

### Khmer Solar Leap

We first begin defining Khmer Solar Leap year (determine if a year has 365 or 366 days). This is calculation is different than how Gregorian leap year.

If Kromthupul is less than or equal 207, then it is a Khmer Solar leap year (366-day year).

Aharkun_mod = (be_year * 292207 + 499) mod 800; Kromthupul = 800 - Aharkun_mod

### Avoman: អាវមាន

Avoman determines if a given year is a leap-day year. Given a year in Buddhist Era as denoted as be_year:

avoman = (Aharkun(be_year) * 11 + 25) mod 692

Based on the avoman value, leap-day year is detemined as follow:

- If it is Khmer solar leap year and Avoman is less than 127 then it is a leap-day year.
- If it is non-Khmer solar leap year:
- if Avoman is less than 138, then it is a leap-day year.
- if Avoman is 137 and the next year has Avoman 0, then the year with Avoman 137 is a normal year and the year with Avoman 0 is a leap-day year.

- Else it is not a leap-day year.

### Aharkun: អាហារគុណ ឬ ហារគុណ

Aharkun is used for Avoman and Bodithey calculation below. Given be_year as a target year in Buddhist Era:

aharkun = ⌊(be_year * 292207 + 499) / 800⌋ + 4Notes: ⌊ ⌋ is a floor function.

### Bodithey: បូតិថី

Bodithey determines if a given year is a leap-month year. Given be_year target year in Buddhist Era:

a = Aharkun(be_year) temp = ⌊(a * 11 + 25) / 692⌋ bodithey = (temp + a + 29) mod 30If Bodithey is greater than 24 or less than 6, then the year is a leap-month. Else it is not a leap-month.

Special Cases:

### Bodithey Leap vs. Protetin Leap

There are two approaches for identifying leap year, Bodithey leap and Protetin leap.

Bodithey leap uses Avoman to determine if a year a leap-day year. It also uses Bodithey to determine if a year is leap-month year. Thus, the result can be both leap-day and leap-month year. So there are four possible types:

- normal year
- leap-month year
- leap-day year
- leap-month and leap-day year

So when Bodithey leap found a year to be both leap-month and leap-day year, that year will represent in the Protetin leap as only a leap-month year. Then we move the leap-day year to next year.

So when checking for Protetin leap for a particular year, it is neccessary to check the previous year for Bodithey leap. If the previous year is of type four, then the current year is a leap-day year.

## Calendar Data

The calculation done here in the monthly calendar is to use AD. So first we need to convert the AD year to BE. Notice that BE year is AD - 544.

Here are the calculation from 2000 AD to 2020 AD.

Year in AD | Year in BE | Aharkun | Avoman | Bodithey | Bod. Leap | Cal. Leap |
---|---|---|---|---|---|---|

2000 | 2544 | 929222 | 627 | 11 | N | - |

2001 | 2545 | 929588 | 501 | 23 | N | N |

2002 | 2546 | 929953 | 364 | 4 | M | M |

2003 | 2547 | 930318 | 227 | 15 | N | N |

2004 | 2548 | 930683 | 90 | 26 | MD |
M |

2005 | 2549 | 931049 | 656 | 7 | N | D |

2006 | 2550 | 931414 | 519 | 18 | N | N |

2007 | 2551 | 931779 | 382 | 29 | M | M |

2008 | 2552 | 932144 | 245 | 10 | N | N |

2009 | 2553 | 932510 | 119 | 22 | D | D |

2010 | 2554 | 932875 | 674 | 2 | M | M |

2011 | 2555 | 933240 | 537 | 13 | N | N |

2012 | 2556 | 933605 | 400 | 24 | M | M |

2013 | 2557 | 933971 | 274 | 6 | N | N |

2014 | 2558 | 934336 | 137 | 17 | N | N |

2015 | 2559 | 934701 | 0 | 28 | MD |
M |

2016 | 2560 | 935067 | 566 | 9 | N | D |

2017 | 2561 | 935432 | 429 | 20 | N | N |

2018 | 2562 | 935797 | 292 | 1 | M | M |

2019 | 2563 | 936162 | 155 | 12 | N | N |

2020 | 2564 | 936528 | 29 | 24 | D | D |

Notes:

Bod. Leap: Bodithey Leap (N:Normal, D:Leap Day, M:Leap Month, MD:Month and Day)

Cal. Leap: Calendar Leap (N:Normal, D:Leap Day, M:Leap Month)

Bod. Leap: Bodithey Leap (N:Normal, D:Leap Day, M:Leap Month, MD:Month and Day)

Cal. Leap: Calendar Leap (N:Normal, D:Leap Day, M:Leap Month)

<< Initial Approach | < Table of Content > | Computer Method >> |