The cycles of the sky have been used to divide time throughout human history. A calendar marks a solar year — the time it takes for the Earth to return to the same place in its orbit of the Sun. The natural division of time is the day — the time it takes for the Sun to return to its highest position in the sky, or cross the meridian. Modern accurate measurements show that
A solar year = 365.242199 days
Notice the large number of significant figures. We know the duration of the Earth's orbit with an accuracy of better than a second!
The Moon has also been used to mark time. The best measurements show that
A lunar month = 29.53059 days
This is the time between two occurrences of the same lunar phase, also called a synodic month. We should not be surprised that these are not whole numbers. It would be entirely fortuitous if three objects in space moved in such a way that a lunar orbit took an exact number of Earth rotations or an Earth orbit took an exact number of Earth rotations. Nor does a lunar month divide evenly into a solar year (365.24 / 29.53 = 12.37) so counting months will not give a good calendar to keep track of the seasons.
The Babylonians had a very accurate calendar of 365.26 days. This number is quoted to five significant figures and differs by only about 30 minutes from the true astronomical number (review the ideas of accuracy and significant figures). Unfortunately, we inherited our calendar from the Romans, who had lost the knowledge of the Babylonian calendar. Our calendar has some very unusual features.
The earliest Roman calendar, from the 7th century B.C., had only 304 days and began in mid-March. This was when the snows had melted enough for the Roman soldiers to go off on conquests. The first month was March, named after Mars the god of war. This is also the reason that the last four months of the year — September, October, November, and December — are taken from the Latin for 7, 8, 9, and 10. Our original calendar only had ten months! The early months of the year were named after popular Roman gods. By the 6th century B.C., two early months had been added to give a year of 354 days. You can see that after only 3 years this calendar would have slipped by (365.24 - 354) × 3 = 34 days or over a month with respect to the seasons. This makes it a very poor calendar.
At the height of the Roman Empire, Julius Caesar reformed the calendar. He added days to all the months to make a total of 365, and added a leap year to make an average count of 365.25 days in the year. The months neatly alternated 30 and 31 days long, except February, which had a short count. The Romans were very superstitious and February was chosen as the "bad luck" month; no Roman would travel or entertain during that month. Caesar also took the next unnamed month for himself. So we have July, after Julius. The Emperor Augustus followed Caesar, and his ego dictated that he grab the next available month for himself. So we have August, after Augustus. However, in the alternating sequence his month was shorter than Caesar's month, so he arbitrarily added a day to it. Then to preserve the same sum of days, he had to add and subtract a day from the rest of the months. That is why you have to say a little rhyme to remember the number of days in each month!
The Julian calendar was quite accurate. It would only lose (365.25 - 365.24) = 0.01 days per year. This error is systematic — always in the same direction — unlike a random measurement error. As a consequence, this tiny error steadily accumulated as the centuries passed, and by the 16th century the calendar had slipped by ten days. In 1582, Pope Gregory moved the date forward ten days by decree. He also added the extra rule that leap years should be skipped in century years unless the year was divisible by 100 — in other words, 1900 was not a leap year but 2000 will be. By this little trick, the Gregorian calendar has an average year that is 365.2422 days long. This is within a thousandth of a day of the astronomical number, so it will be many thousands of years before the Gregorian calendar needs adjustment. Interestingly, the United States and England waited another 180 years to make the switch, as an act of independence by these primarily Protestant countries against the "imposition" of a Catholic calendar.
Religion also figures prominently in the distinction between a solar and a lunar calendar. If biblical texts are followed explicitly, the major Christian holiday of Easter is tied to a lunar calendar and so cannot always fall on a Sunday. The Eastern Orthodox Church split from the Catholic Church over this issue in 325 A.D., and the Orthodox Jewish calendar is also lunar. All Islamic countries follow a lunar calendar. Seasonal changes are not as noticeable in the Middle East, so there is less reason to key the calendar to the Sun. Also, agriculture in the major Middle East civilizations is usually governed by irrigation from major rivers and is less sensitive to seasonal changes. All Islamic countries have a crescent moon in their flag. This is an indication that festivals and holidays depend on observations of the new moon.
A lunar calendar will very quickly shift with respect to a solar calendar. Twelve lunar months give a year that is (12 × 29.53) = 354 days long. Islamic festivals such as Ramadan and the pilgrimage to Mecca therefore advance through our calendar by 11 days every year. Every 365 / 11 = 33 years they shift through an entire cycle of our seasons. This simple but deep-rooted difference in calendars is maybe one reason why Arab and Westerns cultures have difficulty in communicating.