The original calendar which the Romans borrowed from the Greeks consisted of only 10 months (in a year of 304 days).
Martius was the first month, followed by Aprilis, Maius, Junius, Quintilis, Sextilis, September, October, November, and December.
Quintilis means five, Sextilis means six, September is seven, October is eight, November is nine, and December is ten. It was believed that it was Romulus, the legendary first ruler of Rome, who introduced this original calendar in the 700s B.C.E.
Whilst, according to tradition, it was the Roman ruler, Numa Pompilius, who then added January and February to the calendar.
It then made this 12-month Roman Calendar year 355 days, better than the previous 10-month calendar of 304 days only.
To make the calendar corresponds approximately to the solar year, Numa also ordered every other year a month called Mercedinus be inserted to take the place of February.
In years when it was inserted, Mercedinus added 22 or 23 days to the year after the normal February 23 or 24, and the last days of the normal February were moved to the end of this special Mercedinus month that replaces the normal February.
This original calendar then underwent some changes that it was later known as the Julian Calendar, named after Julius Caesar. Month of Quintilis was renamed Julius (July). Julius insisted that Julius month carry 31 days (from the previously 30 days), that the 12th month, February, was deducted 1 day to make it 29 days (from the previous 30 days).
Julian calendar kept to the average annual cycle 365.25 days, that the leap year was introduced every four years when one extra day would be added to February, it being the last month of the year.
During the reign of Augustus Caesar, the month of Sextilis was renamed Augustus (August). To keep at par with Julius, he insisted that the month be made 31 days too (from the previous 30 days). That one day is deducted further from the last month of the year, February, to make it only 28 days on normal years and 29 days on leap years.
It is eventually known to the present day as the Gregorian Calendar named after Pope Gregory XIII, who introduced it in 1582.
It made refinement to annual cycle days where the mean length of the year is now taken as 365.2425 days, instead of 365.25 days, effectively reducing the number of leap years (that only 97 out of 400 years are now leap years).
It follows the rule that for every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400.
For example, the years 1700, 1800, and 1900 are not leap years, but the year 2000 is.
Another significant change, Pope Gregory XIII had decreed that the New Year Day be changed to January 1st, and that January is now considered the first month and December the last month of the year.