On January 1, 1873 (Meiji 6), Japan started using the Gregorian Calendar and thereby moved from a lunar calendar to a solar one. At the same time it modified its traditional Japanese era calendar. Both calendars were used simultaneously, and are still in use today.
January 1, 1873 became the first day of the first month of Meiji 6 (明治6年1月1日), even though the preceding day had been the second day of the twelfth month of Meiji 5 (明治5年12月2日). This amounted to December 2 being followed by January 1. Naturally this caused a great amount of confusion, but the new calendar prevailed nonetheless.
Since the Meiji Period, Japanese eras are named after the current emperor’s reign. This means that whenever a new emperor starts his reign, Japanese dates start from the year 1.
In this way, 1868 became Meiji 1; 1912, Taisho 1; 1926, Showa 1; and 1989, Heisei 1.
An era begins on the day of the year that the emperor ascends the throne. The second year begins on the next January 1st. This is true even if the first year contains only a few days.
For example, the first year of the Showa Period, during which Emperor Hirohito reigned, contained only the last six days of 1926. The final year of his reign, Showa 64, contained only the first seven days of 1989. In such years, there are two names for the year, 1989 is both Showa 64 and Heisei 1.
The emperor is named after his era upon his death. So Emperor Hirohito is known in Japan as Showa Tenno (Emperor Showa).
Japan now uses the months and days of the Gregorian calendar, while the years can be of the Gregorian Calendar or the Japanese era name.