Japan has its own calendar system called WAREKI (和暦). Instead of counting years continuously, it names a period after each reigning Emperor (an era, or gengō 元号) and counts years from the start of that era. For example, the Gregorian year 2026 is written as Reiwa 8. Wareki is still widely used in Japan on official documents, forms and identification cards, so software that handles Japanese dates often needs to convert between it and the Gregorian calendar.
I needed to implement a conversion between Wareki and the Gregorian calendar, so I looked up how the two correspond.
| Era | Start (Wareki) | End (Wareki) | Start (Gregorian) | End (Gregorian) | Notes |
|---|---|---|---|---|---|
| Meiji (明治) | Meiji 1, Jan 1 | Meiji 45, Jul 29 | 1868-01-25 | 1912-07-29 | Era change applied retroactively to Keiō (慶応) 4, Jan 1 (lunar calendar) |
| Taishō (大正) | Taishō 1, Jul 30 | Taishō 15, Dec 24 | 1912-07-30 | 1926-12-24 | Era changed on the day Emperor Meiji passed away |
| Shōwa (昭和) | Shōwa 1, Dec 25 | Shōwa 64, Jan 7 | 1926-12-25 | 1989-01-07 | Era changed on the day Emperor Taishō passed away |
| Heisei (平成) | Heisei 1, Jan 8 | Heisei 31, Apr 30 | 1989-01-08 | 2019-04-30 | Era changed the day after Emperor Shōwa passed away |
| Reiwa (令和) | Reiwa 1, May 1 | - | 2019-05-01 | - | Era changed the day after the 125th Emperor abdicated and became Emperor Emeritus |
Shōwa 1 was very short: only one week, from December 25 to December 31. The start date of Meiji is a date in the old lunisolar calendar, which corresponds to 1868-01-25 in the Gregorian calendar. Japan switched to the Gregorian calendar by declaring Meiji 5, December 3 to be Meiji 6, January 1 (1873-01-01), so month and day values before that date do not map directly onto Gregorian dates.
Converter
Below is a converter between Unix time and Wareki based on this table. It runs entirely in the browser and sends nothing to a server. Unix time denotes an instant in UTC, while era boundaries are defined by calendar days in Japan, so the value is first converted to a JST date and then to Wareki. Dates before Meiji 6, when the Gregorian calendar was adopted, are out of scope.