The convention for the time is 12-hour clock in 24 hours. Hence, the entire day is been divided into 2 halves thus, known as Ante Meridian or (A.M.) and Post Meridian or (P.M.).
As mentioned above that each of the halves consists of 12-hours clock thus, the number is been used from 1 to 12 for the time convention.
Ante Meridian thus start from 12 midnight and stays up to 12 noon whereas Post Meridian begins at 12 noon and stay up till 12 midnight.
It was developed in the 16th BC century.
Thus, a beautiful saying...
"Time and Tide wait for none!"
Cheers to time!