The 12-hour clock is a time convention in which the 24 hours of the day are divided into two periods:a.m. (from the Latin, ante meridiem, meaning before midday) and p.m. (post meridiem, meaning after midday). Each period consists of 12 hours numbered: 12 (acting as zero),1, 2, 3, 4, 5, 6, 7, 8, 9, 10, and 11. The 24 hour/day cycle starts at 12 midnight (often indicated as 12 a.m.), runs through 12 noon (often indicated as 12 p.m.), and continues to the midnight at the end of the day.
The 12-hour clock was developed over time from the mid-second millennium BC to the 16th century AD.
The natural day/night division of a calendar day forms the fundamental basis as to why each day is split into two cycles. Originally there were two cycles; one cycle which could be tracked by the position of the Sun (day) followed by one cycle which could be tracked by the Moon and stars (night). This would eventually evolve into the two 12-hour periods that started at midnight (a.m.) and noon (p.m.) which are used today. Noon itself is rarely abbreviated today, but if it is, it is denoted M.
The 12-hour clock can be traced back as far as Mesopotamia and Ancient Egypt. Both an Egyptian sundial for daytime use and an Egyptian water clock for night-time use were found in the tomb of Pharaoh Amenhotep I. Dating to c. 1500 BC, these clocks divided their respective times of use into 12 hours each.
The Romans also used a 12-hour clock: daylight was divided into 12 equal hours (thus hours having varying length throughout the year) and the night was divided into four watches.
The first mechanical clocks in the 14th century, if they had dials at all, showed all 24 hours, used the 24-hour analog dial, influenced by astronomers' familiarity with the astrolabe and sundial, and their desire to model the Earth's apparent motion around the Sun. In Northern Europe these dials generally used the 12-hour numbering scheme in Roman numerals, but showed both a.m. and p.m. periods in sequence. This is known as the double-XII system, and can be seen on many surviving clock faces, such as those at Wells and Exeter.