This article is from the Calendars FAQ, by Claus Tondering firstname.lastname@example.org with numerous contributions by others.
Calendars are normally based on astronomical events, and the two most
important astronomical objects are the sun and the moon. Their cycles
are very important in the construction and understanding of calendars.
Our concept of a year is based on the earth's motion around the sun.
The time from one fixed point, such as a solstice or equinox, to the
next is called a "tropical year". Its length is currently 365.242190
days, but it varies. Around 1900 its length was 365.242196 days, and
around 2100 it will be 365.242184 days. (This definition of the
tropical year is not quite accurate, see section 1.1 for more
Our concept of a month is based on the moon's motion around the earth,
although this connection has been broken in the calendar commonly used
now. The time from one new moon to the next is called a "synodic
month", and its length is currently 29.5305889 days, but it
varies. Around 1900 its length was 29.5305886 days, and around 2100 it
will be 29.5305891 days.
Note that these numbers are averages. The actual length of a
particular year may vary by several minutes due to the influence of
the gravitational force from other planets. Similarly, the time
between two new moons may vary by several hours due to a number of
factors, including changes in the gravitational force from the sun,
and the moon's orbital inclination.
It is unfortunate that the length of the tropical year is not a
multiple of the length of the synodic month. This means that with 12
months per year, the relationship between our month and the moon
cannot be maintained.
However, 19 tropical years is 234.997 synodic months, which is very
close to an integer. So every 19 years the phases of the moon fall on
the same dates (if it were not for the skewness introduced by leap
years). 19 years is called a Metonic cycle (after Meton, an astronomer
from Athens in the 5th century BC).
So, to summarise: There are three important numbers to note:
A tropical year is 365.24219 days.
A synodic month is 29.53059 days.
19 tropical years is close to an integral number of synodic months.
The Christian calendar is based on the motion of the earth around the
sun, while the months retain no connection with the motion of the moon.
On the other hand, the Islamic calendar is based on the motion of the
moon, while the year has no connection with the motion of the earth
around the sun.
Finally, the Hebrew calendar combines both, in that its years are
linked to the motion of the earth around the sun, and its months are
linked to the motion of the moon.