Muslims measure the passage of time using the Islamic (Hijrah) calendar. This calendar has twelve lunar months, the beginnings and endings of which are determined by the sighting of the crescent moon. Years are counted since the Hijrah, which is when the Prophet Muhammad migrated from Mecca to Madinah (approximately July 622 A.D.).
The Islamic calendar was first introduced by the close companion of the Prophet, 'Umar ibn Al-Khattab. During his leadership of the Muslim community, in approximately 638 A.D., he consulted with his advisors in order to come to a decision regarding the various dating systems used at that time. It was agreed that the most appropriate reference point for the Islamic calendar was the Hijrah, since it was an important turning point for the Muslim community. After the emigration to Madinah (formerly known as Yathrib), the Muslims were able to organize and establish the first real Muslim "community," with social, political, and economic independence. Life in Madinah allowed the Muslim community to mature and strengthen, and the people developed an entire society based on Islamic principles.
The Islamic calendar is the official calendar in many Muslim countries, especially Saudi Arabia. Other Muslim countries use the Gregorian calendar for civil purposes and only turn to the Islamic calendar for religious purposes.
The Islamic year has twelve months that are based on a lunar cycle. Allah says in the Qur'an:
"The number of months in the sight of Allah is twelve (in a year) - so ordained by Him the day He created the heavens and the earth...." (9:36).
"It is He Who made the sun to be a shining glory, and the moon to be a light of beauty, and measured out stages for it, that you might know the number of years and the count of time. Allah did not create this except in truth and righteousness. And He explains His signs in detail, for those who understand" (10:5).
And in his final sermon before his death, the Prophet Muhammad said, among other things, "With Allah the months are twelve; four of them are holy; three of these are successive and one occurs singly between the months of Jumaada and Sha'ban."