Modifier

Partager via


Calendars

A calendar organizes periods of time into groups like days, weeks, months, and years. There are three main types of calendars in common use: solar, lunar, and lunisolar.

The Gregorian calendar, used in many countries and regions, is an example of a solar calendar. A solar calendar is based on the apparent position of the Sun relative to the stars. The Gregorian calendar organizes a year into 12 months, each having between 28 and 31 days. A leap day is intermittently added to the month of February to adjust for the difference between the standard year length of 365 days and the time taken for the Earth to complete an orbit of the Sun (slightly more than 365 days). Many countries and regions that use the Gregorian calendar uses an epoch of an estimate of the incarnation of Jesus as the year 0. The Japanese version of the Gregorian calendar uses an epoch corresponding to the succession of a new emperor, along with a name for each era.

The Hijri calendar, also known as the Islamic calendar, is an example of a lunar calendar. A lunar calendar is based on the cycle of the Moon’s phases. The Islamic calendar organizes a year into 12 lunar months, each having between 29 or 30 days. The lunar year (twelve complete lunar cycles) is shorter than the solar year so the months of the Hijri calendar advance by about 11 days each year. The Hijri calendar uses an epoch of the year of Muhammad’s Hijrah (الهجرة) to Medina.

The Hebrew calendar is an example of a lunisolar calendar. A lunisolar calendar combines lunar and solar cycles, where the lunar phases determine the months, and the solar cycles determine the years. To adjust for the difference between the lunar year and the solar year, an extra month is intermittently added. The Hebrew calendar uses an epoch corresponding to the creation of the world according to the Bible. Another example of a lunisolar calendar is the Buddhist calendar used in Southeast Asia.

Countries and regions might use different calendars depending on the context. For example, the Gregorian calendar might be used for business, while the Hijri calendar might be used within religious practices.

As each type of calendar has months of different lengths, different number of months, and different dates for the beginning of the new year, converting a date from one calendar to the same date in a different calendar might not be trivial. Fortunately, libraries like ICU, frameworks like .NET, and programming languages like Java can help you display dates in the correct format for users’ locales, and convert dates respective to the calendar being used. These frameworks can also help with date arithmetic, such as calculating the number of days between two dates.