(Explanation mostly meant as documentation of the jdate program for a Western reader, but possibly of more general interest.)

Japanese date conversion

Japanese has dates like 文久二年八月十日 where the Western world has dates like 1862-09-03. How do these correspond?

The characters 年, 月, 日 mean Year, Month, Day, so that 1862年9月3日 is the same as 1862-09-03.

(This follows the ISO 8601 standard. An American might write 9/3/1862. Elsewhere one might see for example 3.9.1862. On this page all western dates are standard, i.e. Y-M-D.)
The symbols 一, 二, 三, 四, 五, 六, 七, 八, 九, 十 are the Japanese digits 1-10. We see that 文久二年八月十日 spells 文久 2-8-10.
Counting up to 30:
1 2 3 4 5 6 7 8 9 10
+0
+10十一 十二 十三 十四 十五 十六 十七 十八 十九 二十
+20二十一 二十二 二十三 二十四 二十五 二十六 二十七 二十八 二十九 三十
The 文久 (Bunkyū) of the example gives the Era (年号, nengō, or 元号, gengō). The start of the era is the point of reference for the year number, like Western A.D. or Roman AUC. Often, an Era is the period of reign of an emperor.

Just like Western days continue going Sunday, Monday, ... regardless of month or year, the Japanese years, months and days continue counting regardless of the era, except that in each era the year is given relative to its starting point. For example, the 昭和 (Shōwa) era began in 1926-12-25, and the 平成 (Heisei) era in 1989-01-08. Here 1989-01-07 is 昭和64年1月7日 (Shōwa 64-1-7), and 1989-01-08 is 平成1年1月8日 (Heisei 1-1-8).

Instead of 1年 or 一年, one often sees 元年 for the first year of an era. Instead of 二十 one sees 廿 for twenty (in the numbers 21..29). For example, 文化元年九月廿四日 stands for Bunka 1-9-24, that is 1804-10-27.
Since 1868 one (retroactively) uses a single era name for an entire year. Consequently 1989-01-01 is (now that the new era has started) written 平成1年1月1日. And while the change of era name from Keiō to Meiji took place on 1868-10-23, one uses Meiji dates from Meiji 1-01-01, that is 1868-01-25.

Converting recent dates

Since 1873-01-01 the system of months and days follows the Gregorian calendar.
That is, there are twelve months of 31, 28 (or 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 days, where February has 29 days if the AD year number is divisible by 4 and for years divisible by 100, if it is divisible by 400. In English these months are called January, February, ... In Japanese they are usually just numbered 1 to 12.
This means that conversion of recent dates is trivial: Japanese month and day agree with Western month and day, and Western year is Japanese year plus era offset.
Era rom. starting date offset
明治 Meiji 1868-10-23 1867
大正 Taishō 1912-07-30 1911
昭和 Shōwa 1926-12-25 1925
平成 Heisei 1989-01-08 1988
令和 Reiwa 2019-05-01 2018
For example, 平成27年6月1日 is 2015-06-01.

Western complications

Here we want to describe the Japanese calendar relative to the Western one. But if one goes back in time there are all sorts of complications in the Western calendar. We avoid them by defining a normalized Western calendar. We assume that the Gregorian calendar was used starting from Friday 15 October 1582, and that this day was preceded by Thursday 4 October 1582, so that ten dates were skipped. That before this, the Julian calendar was used.
The Julian and Gregorian calendar are the same, except that the Julian calendar has a leapday every four years, and no additional rule about years divisible by 100.
The Gregorian calendar provided a better approximation to the length of a year, and its use was ordained by pope Gregory XIII in 1582. Catholic countries changed after 1582-10-04, but protestant and eastern orthodox countries changed later. The Unix cal command shows a short month September 1752
% cal 9 1752
   September 1752     
Su Mo Tu We Th Fr Sa  
       1  2 14 15 16  
17 18 19 20 21 22 23  
24 25 26 27 28 29 30  
(where the day following Wednesday 1752-09-02 is Thursday 1752-09-14, skipping eleven dates): the British empire changed in 1752. Russia changed in 1918, Greece in 1923.

A different complication is the start of a year. At which (month,day) is the year number incremented? The Gregorian calendar stipulates a year change at 1 January. Earlier, usage varied. In various places one used 1 March or 25 March or 1 September or 25 December (Christmas) or Easter. Thus, it may be that 24 March 1300 was followed by 25 March 1301.

Where Easter is used the number of days with given year varied, and it could happen that the same (year,month,day) triple occurred twice (because the first Easter fell on an early date, the second on a later date). Historians need Easter tables to interpret such dates. We shall ignore such subtleties, and use a Julian calendar where the year starts at 1 January.

The lunisolar calendar

Before 1873-01-01 the Japanese calendar had a year with twelve or thirteen months, each of 29 or 30 days, where in principle the details are determined astronomically.
In early years the sequence of long and short months was sometimes modified for cultural purposes.
The start of a month would be the New Moon, with starts 29 or 30 days apart. Twelve periods of 29 or 30 days give about 354 days, but the year has a length of about 365.24 days, so some years have 12 months (and 353-355 days) some 13 months (and 383-385 days).
Frequent are years of length 354, 355, 384; length 383 is less frequent; lengths 353 and 385 are rare. [My data show two years of length 356: Saikō 1 (854) and Kampyō 3 (891), which have four 29-day months and eight 30-day months. Maybe a mistake. However, it happens that there are three, or even four long months in a row. See below.]
The numbering of the months is determined by the solar year: Twelve solar points divide the year into twelve equal parts, starting at the winter solstice. (The third after that is the spring equinox, the third after that the summer solstice, the third after that the autumn equinox.) The month in which the spring equinox occurs is Month 2, the month in which the winter solstice occurs is Month 11. Since the time between two solar points is slightly longer than the length of a month, every now and then there is a month without solar point. It is called an intercalary (閏, urū) month, and gets the number of the preceding month. (English has the vaguely similar concept of blue moon.)
So, very roughly, Month 1 is February: month numbers are shifted by 1 or 2 compared to Western dates. If Spring is defined so that the spring equinox occurs in the middle, then the start of Month 1 is close to the start of Spring.
Since 19 years have almost precisely 235 months, we get about 7 intercalary months every 19 years. There are never two intercalary months in the same year. Intercalary months can have any number from 1 to 12. Number 11 is slightly less frequent.
The above description gives the theory. Historically, many mistakes have been made, and the place of insertion of an intercalary month varies. Consequently, one needs tables rather than formulas.
All this means that in order to convert Japanese dates into Western, one needs a table of month lengths and the occurrences of intercalary months for the past thousand years or so, plus a table giving the (western) starting year of each era. In order to convert a Western date to Japanese, one also needs the (Japanese) starting month and day of each era. The program jdate contains such tables. Here we show a fragment covering the past two hundred years.

List of Eras

Era rom. starting date (J) starting date (W) offset
文亀 Bunki 明応10年2月29日 1501-03-18 1500
永正 Eishō 文亀4年2月30日 1504-03-16 1503
大永 Daiei 永正18年8月23日 1521-09-23 1520
享禄 Kyōroku 大永8年8月20日 1528-09-03 1527
天文 Tenbun 享禄5年7月29日 1532-08-29 1531
弘治 Kōji 天文24年10月23日 1555-11-07 1554
永禄 Eiroku 弘治4年2月28日 1558-03-18 1557
元亀 Genki 永禄13年4月23日 1570-05-27 1569
天正 Tenshō 元亀4年7月28日 1573-08-25 1572
文禄 Bunroku 天正20年12月8日 1593-01-10 1591
慶長 Keichō 文禄5年10月27日 1596-12-16 1595
元和 Genna 慶長20年7月13日 1615-09-05 1614
寛永 Kan'ei 元和10年2月30日 1624-04-17 1623
正保 Shōhō 寛永21年12月16日 1645-01-13 1643
慶安 Keian 正保5年2月15日 1648-04-07 1647
承応 Jōō 慶安5年9月18日 1652-10-20 1651
明暦 Meireki 承応4年4月13日 1655-05-18 1654
万治 Manji 明暦4年7月23日 1658-08-21 1657
寛文 Kanbun 万治4年4月25日 1661-05-23 1660
延宝 Enpō 寛文13年9月21日 1673-10-30 1672
天和 Tenna 延宝9年9月29日 1681-11-09 1680
貞享 Jōkyō 天和4年2月21日 1684-04-05 1683
元禄 Genroku 貞享5年9月30日 1688-10-23 1687
宝永 Hōei 元禄17年3月13日 1704-04-16 1703
正徳 Shōtoku 宝永8年4月25日 1711-06-11 1710
享保 Kyōhō 正徳6年6月22日 1716-08-09 1715
元文 Genbun 享保21年4月28日 1736-06-07 1735
寛保 Kanpō 元文6年2月27日 1741-04-12 1740
延享 Enkyō 寛保4年2月21日 1744-04-03 1743
寛延 Kan'en 延享5年7月12日 1748-08-05 1747
宝暦 Hōreki 寛延4年10月27日 1751-12-14 1750
明和 Meiwa 宝暦14年6月2日 1764-06-30 1763
安永 An'ei 明和9年11月16日 1772-12-10 1771
天明 Tenmei 安永10年4月2日 1781-04-25 1780
寛政 Kansei 天明9年1月25日 1789-02-19 1788
享和 Kyōwa 寛政13年2月5日 1801-03-19 1800
文化 Bunka 享和4年2月11日 1804-03-22 1803
文政 Bunsei 文化15年4月22日 1818-05-26 1817
天保 Tenpō 文政13年12月10日 1831-01-23 1829
弘化 Kōka 天保15年12月2日 1845-01-09 1843
嘉永 Kaei 弘化5年2月28日 1848-04-01 1847
安政 Ansei 嘉永7年11月27日 1855-01-15 1853
万延 Man'en 安政7年3月18日 1860-04-08 1859
文久 Bunkyū 万延2年2月19日 1861-03-29 1860
元治 Genji 文久4年2月20日 1864-03-27 1863
慶応 Keiō 元治2年4月7日 1865-05-01 1864
明治 Meiji 慶応4年9月8日 1868-10-23 1867
大正 Taishō 明治45年7月30日 1912-07-30 1911
昭和 Shōwa 大正15年12月25日 1926-12-25 1925
平成 Heisei 昭和64年1月8日 1989-01-08 1988
令和 Reiwa 平成31年5月1日 2019-05-01 2018

The N-th year of an era starts in, and coincides for a large part (10 months or more) with, Western (Gregorian) year offset+N. Usually, the start of an era will be in year offset+1, but if the era started near the end of the Japanese year, the date can fall into year offset+2. For example, Ansei has offset 1853, so that year 1 of Ansei mostly coincides with 1854. However, the Ansei era started near the end of that Japanese year, on 1855-01-15, and most of 1854 belongs to Kaei 7.

Month Table

The table below gives for years in 1750-1872 the Western starting date of each Japanese month.
For example, Japanese year 1764 has an intercalary month 12 (see column 12'), and it starts on 1765-01-21.

1 1' 2 2' 3 3' 4 4' 5 5' 6 6' 7 7' 8 8' 9 9' 10 10' 11 11' 12 12'
1750-02-07 3-08 4-07 5-06 6-04 7-04 8-02 9-01 9-30 10-30 11-29 12-29 
1751-01-27 2-26 3-27 4-26 5-25 6-237-238-21 9-20 10-19 11-18 12-18 +1-16 
1752-02-15 3-16 4-14 5-14 6-12 7-11 8-10 9-08 10-07 11-06 12-06 +1-04 
1753-02-03 3-05 4-04 5-03 6-02 7-01 7-30 8-29 9-27 10-26 11-25 12-25 
1754-01-23 2-223-244-22 5-22 6-21 7-20 8-18 9-17 10-16 11-14 12-14 +1-12 
1755-02-11 3-13 4-12 5-11 6-10 7-09 8-08 9-06 10-06 11-04 12-03 +1-02 
1756-01-31 3-01 3-31 4-29 5-29 6-27 7-27 8-26 9-24 10-24 11-2212-22+1-20 
1757-02-18 3-20 4-18 5-18 6-17 7-16 8-15 9-13 10-13 11-12 12-11 +1-10 
1758-02-08 3-10 4-08 5-07 6-06 7-05 8-04 9-02 10-02 11-01 12-01 12-30 
1759-01-29 2-27 3-29 4-27 5-26 6-25 7-248-239-21 10-21 11-20 12-19 +1-18 
1760-02-17 3-17 4-16 5-15 6-13 7-13 8-11 9-09 10-09 11-08 12-07 +1-06 
1761-02-05 3-07 4-05 5-05 6-03 7-02 8-01 8-30 9-28 10-28 11-26 12-26 
1762-01-25 2-24 3-26 4-245-246-22 7-21 8-20 9-18 10-17 11-16 12-15 +1-14 
1763-02-13 3-15 4-13 5-13 6-11 7-11 8-09 9-08 10-07 11-05 12-05 +1-03 
1764-02-02 3-03 4-01 5-01 5-31 6-29 7-29 8-27 9-26 10-25 11-23 12-23+1-21
1765-02-20 3-21 4-20 5-20 6-18 7-18 8-17 9-15 10-15 11-13 12-13 +1-11 
1766-02-09 3-11 4-09 5-09 6-07 7-07 8-06 9-04 10-04 11-03 12-02 +1-01 
1767-01-30 2-28 3-30 4-28 5-28 6-26 7-26 8-24 9-2310-2311-21 12-21 +1-20 
1768-02-18 3-19 4-17 5-16 6-15 7-14 8-12 9-11 10-11 11-09 12-09 +1-08 
1769-02-07 3-08 4-07 5-06 6-04 7-04 8-02 8-31 9-30 10-29 11-28 12-28 
1770-01-27 2-26 3-27 4-26 5-25 6-237-238-21 9-19 10-19 11-17 12-17 +1-16 
1771-02-15 3-16 4-15 5-14 6-13 7-12 8-11 9-09 10-08 11-07 12-06 +1-05 
1772-02-04 3-04 4-03 5-03 6-01 7-01 7-30 8-29 9-27 10-26 11-25 12-24 
1773-01-23 2-21 3-234-225-21 6-20 7-20 8-18 9-17 10-16 11-14 12-14 +1-12 
1774-02-11 3-12 4-11 5-11 6-09 7-09 8-07 9-06 10-05 11-04 12-03 +1-02 
1775-01-31 3-02 3-31 4-30 5-29 6-28 7-27 8-26 9-25 10-24 11-23 12-23+1-21
1776-02-19 3-20 4-18 5-18 6-16 7-16 8-14 9-13 10-12 11-11 12-11 +1-10 
1777-02-08 3-10 4-08 5-07 6-06 7-05 8-03 9-02 10-01 10-31 11-30 12-30 
1778-01-28 2-27 3-29 4-27 5-26 6-25 7-248-229-21 10-20 11-19 12-19 +1-18 
1779-02-16 3-18 4-17 5-16 6-14 7-14 8-12 9-10 10-10 11-08 12-08 +1-07 
1 1' 2 2' 3 3' 4 4' 5 5' 6 6' 7 7' 8 8' 9 9' 10 10' 11 11' 12 12'
1780-02-05 3-06 4-05 5-04 6-03 7-02 8-01 8-30 9-28 10-28 11-26 12-26 
1781-01-24 2-23 3-25 4-24 5-236-227-21 8-20 9-18 10-17 11-16 12-15 +1-14 
1782-02-12 3-14 4-13 5-12 6-11 7-10 8-09 9-07 10-07 11-05 12-05 +1-03 
1783-02-02 3-03 4-02 5-01 5-31 6-30 7-29 8-28 9-26 10-26 11-24 12-24 
1784-01-222-213-21 4-20 5-19 6-18 7-17 8-16 9-15 10-14 11-13 12-12 +1-11 
1785-02-09 3-11 4-09 5-09 6-07 7-06 8-05 9-04 10-03 11-02 12-02 12-31 
1786-01-30 2-28 3-30 4-28 5-28 6-26 7-25 8-24 9-22 10-2211-2112-21 +1-19 
1787-02-18 3-20 4-18 5-17 6-16 7-15 8-13 9-12 10-11 11-10 12-10 +1-08 
1788-02-07 3-08 4-06 5-06 6-04 7-04 8-02 8-31 9-30 10-29 11-28 12-27 
1789-01-26 2-25 3-27 4-25 5-25 6-237-238-21 9-19 10-19 11-17 12-17 +1-15 
1790-02-14 3-16 4-14 5-14 6-13 7-12 8-11 9-09 10-08 11-07 12-06 +1-05 
1791-02-03 3-05 4-03 5-03 6-02 7-01 7-31 8-29 9-28 10-27 11-26 12-25 
1792-01-24 2-223-234-21 5-21 6-19 7-19 8-18 9-16 10-16 11-14 12-14 +1-12 
1793-02-11 3-12 4-11 5-10 6-09 7-08 8-07 9-05 10-05 11-04 12-03 +1-02 
1794-01-31 3-02 3-31 4-30 5-29 6-27 7-27 8-25 9-24 10-24 11-2312-22+1-21 
1795-02-19 3-21 4-19 5-19 6-17 7-16 8-15 9-13 10-13 11-12 12-11 +1-10 
1796-02-09 3-09 4-08 5-07 6-06 7-05 8-03 9-02 10-01 10-31 11-29 12-29 
1797-01-28 2-27 3-28 4-27 5-26 6-25 7-248-229-20 10-20 11-18 12-18 +1-17 
1798-02-16 3-17 4-16 5-16 6-14 7-14 8-12 9-10 10-10 11-08 12-07 +1-06 
1799-02-05 3-06 4-05 5-05 6-04 7-03 8-01 8-31 9-29 10-29 11-27 12-26 
1800-01-25 2-24 3-25 4-245-246-22 7-22 8-20 9-19 10-18 11-17 12-16 +1-15 
1801-02-13 3-15 4-13 5-13 6-11 7-11 8-09 9-08 10-08 11-06 12-06 +1-04 
1802-02-03 3-04 4-03 5-02 5-31 6-30 7-29 8-28 9-27 10-27 11-25 12-25 
1803-01-232-223-23 4-22 5-21 6-19 7-19 8-17 9-16 10-16 11-14 12-14 +1-13 
1804-02-11 3-12 4-10 5-10 6-08 7-07 8-06 9-04 10-04 11-02 12-02 +1-01 
1805-01-31 3-01 3-31 4-29 5-29 6-27 7-26 8-249-2310-22 11-21 12-21 +1-20 
1806-02-18 3-20 4-19 5-18 6-17 7-16 8-14 9-12 10-12 11-10 12-10 +1-09 
1807-02-07 3-09 4-08 5-08 6-06 7-06 8-04 9-02 10-02 10-31 11-29 12-29 
1808-01-28 2-26 3-27 4-26 5-25 6-247-238-22 9-20 10-20 11-18 12-17 +1-16 
1809-02-14 3-16 4-15 5-14 6-13 7-13 8-11 9-10 10-09 11-08 12-07 +1-06 
1 1' 2 2' 3 3' 4 4' 5 5' 6 6' 7 7' 8 8' 9 9' 10 10' 11 11' 12 12'
1810-02-04 3-05 4-04 5-03 6-02 7-02 7-31 8-30 9-29 10-28 11-27 12-26 
1811-01-25 2-233-244-23 5-22 6-21 7-20 8-19 9-18 10-17 11-16 12-16 +1-14 
1812-02-13 3-13 4-12 5-11 6-09 7-09 8-07 9-06 10-05 11-04 12-04 +1-03 
1813-02-01 3-03 4-01 5-01 5-30 6-28 7-27 8-26 9-24 10-24 11-2312-23+1-21 
1814-02-20 3-22 4-20 5-20 6-18 7-17 8-15 9-14 10-13 11-12 12-12 +1-10 
1815-02-09 3-11 4-10 5-09 6-08 7-07 8-05 9-03 10-03 11-01 12-01 12-30 
1816-01-29 2-28 3-29 4-27 5-27 6-25 7-25 8-239-2210-21 11-19 12-19 +1-17 
1817-02-16 3-18 4-16 5-16 6-15 7-14 8-13 9-11 10-11 11-09 12-08 +1-07 
1818-02-05 3-07 4-06 5-05 6-04 7-03 8-02 9-01 9-30 10-30 11-28 12-27 
1819-01-26 2-24 3-26 4-245-246-22 7-22 8-21 9-19 10-19 11-18 12-17 +1-16 
1820-02-14 3-14 4-13 5-12 6-11 7-10 8-09 9-07 10-07 11-06 12-06 +1-04 
1821-02-03 3-04 4-03 5-02 5-31 6-30 7-29 8-28 9-26 10-26 11-25 12-24 
1822-01-232-223-23 4-22 5-21 6-19 7-18 8-17 9-15 10-15 11-14 12-13 +1-12 
1823-02-11 3-13 4-11 5-11 6-09 7-08 8-06 9-05 10-04 11-03 12-02 +1-01 
1824-01-31 3-01 3-31 4-29 5-28 6-27 7-26 8-249-2310-22 11-21 12-20 +1-19 
1825-02-18 3-20 4-18 5-18 6-16 7-16 8-14 9-13 10-12 11-10 12-10 +1-08 
1826-02-07 3-09 4-07 5-07 6-06 7-05 8-04 9-02 10-02 10-31 11-29 12-29 
1827-01-27 2-26 3-27 4-26 5-26 6-247-248-22 9-21 10-21 11-19 12-18 +1-17 
1828-02-15 3-16 4-14 5-14 6-12 7-12 8-11 9-09 10-09 11-07 12-07 +1-06 
1829-02-04 3-05 4-04 5-03 6-02 7-01 7-31 8-29 9-28 10-28 11-26 12-26 
1830-01-25 2-23 3-244-235-22 6-21 7-20 8-18 9-17 10-17 11-15 12-15 +1-14 
1831-02-13 3-14 4-13 5-12 6-10 7-09 8-08 9-06 10-06 11-04 12-04 +1-03 
1832-02-02 3-03 4-01 5-01 5-30 6-28 7-27 8-26 9-24 10-24 11-2212-22+1-21 
1833-02-20 3-21 4-20 5-19 6-18 7-17 8-15 9-14 10-13 11-12 12-11 +1-10 
1834-02-09 3-10 4-09 5-09 6-07 7-07 8-05 9-03 10-03 11-01 12-01 12-30 
1835-01-29 2-27 3-29 4-28 5-27 6-26 7-268-249-22 10-22 11-20 12-20 +1-18 
1836-02-17 3-17 4-16 5-15 6-14 7-14 8-12 9-11 10-10 11-09 12-08 +1-07 
1837-02-05 3-07 4-05 5-05 6-03 7-03 8-01 8-31 9-30 10-29 11-28 12-27 
1838-01-26 2-24 3-26 4-245-246-22 7-21 8-20 9-19 10-18 11-17 12-17 +1-15 
1839-02-14 3-15 4-14 5-13 6-11 7-11 8-09 9-08 10-07 11-06 12-06 +1-05 
1 1' 2 2' 3 3' 4 4' 5 5' 6 6' 7 7' 8 8' 9 9' 10 10' 11 11' 12 12'
1840-02-03 3-04 4-03 5-02 5-31 6-29 7-29 8-27 9-26 10-25 11-24 12-24 
1841-01-232-213-23 4-21 5-21 6-19 7-18 8-17 9-15 10-15 11-13 12-13 +1-12 
1842-02-10 3-12 4-11 5-10 6-09 7-08 8-06 9-05 10-04 11-03 12-02 +1-01 
1843-01-30 3-01 3-31 4-30 5-29 6-28 7-27 8-25 9-2410-2311-22 12-21 +1-20 
1844-02-18 3-19 4-18 5-17 6-16 7-15 8-14 9-12 10-12 11-10 12-10 +1-08 
1845-02-07 3-08 4-07 5-06 6-05 7-05 8-03 9-02 10-01 10-31 11-29 12-29 
1846-01-27 2-26 3-27 4-26 5-256-247-23 8-22 9-21 10-20 11-19 12-18 +1-17 
1847-02-15 3-17 4-15 5-15 6-13 7-12 8-11 9-10 10-09 11-08 12-08 +1-06 
1848-02-05 3-05 4-04 5-03 6-01 7-01 7-30 8-29 9-27 10-27 11-26 12-26 
1849-01-24 2-23 3-24 4-235-226-20 7-20 8-18 9-17 10-16 11-15 12-15 +1-13 
1850-02-12 3-14 4-12 5-12 6-10 7-09 8-08 9-06 10-06 11-04 12-04 +1-02 
1851-02-01 3-03 4-02 5-01 5-31 6-29 7-28 8-27 9-25 10-25 11-23 12-23 
1852-01-21 2-203-214-19 5-19 6-18 7-17 8-15 9-14 10-13 11-12 12-11 +1-10 
1853-02-08 3-10 4-08 5-08 6-07 7-06 8-05 9-03 10-03 11-01 12-01 12-30 
1854-01-29 2-27 3-29 4-27 5-27 6-25 7-258-249-22 10-22 11-20 12-20 +1-18 
1855-02-17 3-18 4-17 5-16 6-14 7-14 8-13 9-11 10-11 11-10 12-09 +1-08 
1856-02-06 3-07 4-05 5-04 6-03 7-02 8-01 8-30 9-29 10-29 11-28 12-27 
1857-01-26 2-24 3-26 4-24 5-236-227-21 8-20 9-18 10-18 11-17 12-16 +1-15 
1858-02-14 3-15 4-14 5-13 6-11 7-11 8-09 9-07 10-07 11-06 12-05 +1-04 
1859-02-03 3-05 4-03 5-03 6-01 6-30 7-30 8-28 9-26 10-26 11-24 12-24 
1860-01-23 2-22 3-224-215-21 6-19 7-18 8-17 9-15 10-14 11-13 12-12 +1-11 
1861-02-10 3-11 4-10 5-10 6-08 7-08 8-06 9-05 10-04 11-03 12-02 12-31 
1862-01-30 3-01 3-30 4-29 5-29 6-27 7-27 8-259-2410-23 11-22 12-21 +1-20 
1863-02-18 3-19 4-18 5-18 6-16 7-16 8-14 9-13 10-13 11-11 12-11 +1-09 
1864-02-08 3-08 4-06 5-06 6-04 7-04 8-02 9-01 10-01 10-31 11-29 12-29 
1865-01-27 2-26 3-27 4-25 5-256-237-23 8-21 9-20 10-20 11-18 12-18 +1-17 
1866-02-15 3-17 4-15 5-15 6-13 7-12 8-10 9-09 10-09 11-07 12-07 +1-06 
1867-02-05 3-06 4-05 5-04 6-03 7-02 7-31 8-29 9-28 10-27 11-26 12-26 
1868-01-25 2-23 3-24 4-235-226-20 7-20 8-18 9-16 10-16 11-14 12-14 +1-13 
1869-02-11 3-13 4-12 5-12 6-10 7-09 8-08 9-06 10-05 11-04 12-03 +1-02 
1870-02-01 3-02 4-01 5-01 5-30 6-29 7-28 8-27 9-25 10-2511-2312-22 +1-21 
1871-02-19 3-21 4-20 5-19 6-18 7-18 8-16 9-15 10-14 11-13 12-12 +1-10 
1872-02-09 3-09 4-08 5-07 6-06 7-06 8-04 9-03 10-03 11-01 12-01 12-30 

Here m' indicates the intercalary month following month m (if there is one). The + in the last two columns indicates dates in the Gregorian year following that of the first column.

We see that the Japanese year starts a few weeks after the start of the Western year. Inspection of a larger table gives as earliest start of the year Jan 14 (in 1553) and as latest start of the year Feb 22 (in 1659). The average offset is 33 days, roughly 1 month.

Notes

Duplicate Era Names

In Japanese, the era names are distinct. However, with common transliterations one may get duplication. For example Eishō (永承, 永正), Enkyō/Enkyū (延久, 延慶, 延享), Genkō (元亨, 元弘), Jōgen/Shōgen (貞元, 承元), Jōhei/Shōhei (承平, 正平), Jōō/Shōō (貞応, 正応, 承応), Jōryaku/Shōryaku (正暦, 承暦), Jōtoku/Shōtoku (承徳, 正徳), Jōwa/Shōwa (承和, 貞和, 正和, 昭和), Kangen/Kengen (寛元, 乾元), Kajō/Kashō (嘉祥, 嘉承), Kōan (弘安, 康安), Kōji (康治, 弘治), Kōwa (康和, 弘和), Tenji (天智, 天治), Tenshō (天承, 天正). Of course details depend on the transliteration used. There is common variation between np/mp (as in Tenpō/Tempō), between nn/nw (as in Tenna/Tenwa), between sh/j (as in Shōō/Jōō), between d/t (as in Daiei/Taiei), etc.

Northern/Southern Court

There is a different source of duplication: in the period 1329-1392 there were two rival courts, each using their own era names. For conversion from Japanese to Western date that doesn't matter - only the base year of each era is needed. For the converse direction one needs to specify whether the date must be given in terms of the eras of the Northern or of the Southern Court.

Meiji Transition

On 1873-01-01 the Gregorian calendar was introduced. This means that 明治5年12月2日 = 1872-12-31 was followed by 明治6年1月1日 = 1873-01-01, and the twelfth month of 明治5 = 1872 had only two days.

Four consecutive long months

In early years, it was felt that there should not be four long months in a row (Tsumura, 2010). When e.g. in 964, 1089, 1317, 1433 the computation yielded four consecutive long months, the last of these was made short (and the following one long), starting the next month 1 day earlier. In 1495/1496 and later (e.g. in 1831/1832) this situation happened again, but nothing was done.

Other Modifications

Because 19 years contain almost exactly 235 months (Metonic cycle), calendrical patterns tend to repeat every 19 years. In 784 the Winter Solstice occurred on the first day of the 11th month, and so one wished to see that again every 19 years (and celebrate). More or less extensive modifications were sometimes needed to make that happen. In 860 the 11th month was started a day later, to coincide with Winter Solstice. In 1050 the intercalary 11th month was started a day earlier, to coincide with Winter Solstice (and it became the 11th month, following an intercalary 10th month). In 1316 seven months had to be shifted in order to have Winter Solstice on the first day of the 11th month and also avoid four long months in a row. In 1487 the solstice was left at the end of the 11th month. (Tsumura, 2010).

Examples

The Ansei era (安政) started 1855-01-15, that is Ansei 1-11-27. The Japanese Wikipedia agrees, but the English one today calls this date November 27, 1854.

Honinbo Shusaku was born 文政12年5月5日, that is 1829-06-06, and died 文久2年8月10日, that is 1862-09-03. The Japanese and German Wikipedias agree, but the English one today calls this September 7, 1862. The reason is funny: John F. made a mistake on SL, and some anonymous user undoes attempts to correct this.

Differences

All sources agree on the above month table. But for earlier dates there are differences. We list all variations seen after 1500.

1731

nengocalc refers to two sources, Tsuchihashi and Zöllner, and provides a file datenbasis.pdf showing the differences. There is a single difference past 1563, namely the entry for 1731: according to Tsuchihashi 享保16年2月1日 was 1731-03-08, according to Zöllner 1731-03-09. All my sources agree with the former.

1697

jdate prints for 1697 the list of month starts
    1697-01-23   02-21  *03-23   04-21   05-20   06-19   07-18   08-17   09-15   10-15   11-14   12-13   +01-12
(where * indicates the intercalary month), while wp/元禄 has
    1697-01-23   02-21  *03-23   04-21   05-21   06-19   07-19   08-17   09-16   10-15   11-14   12-13   +01-12
(so e.g. 元禄10年4月1日 was 1697-05-20 or 1697-05-21; time/ and kanreki/ agree with the former).
The former corresponds to a sequence of month lengths
    29, 30, *29, 29, 30, 29, 30, 29, 30, 30, 29, 30, 30
the latter to
    29, 30, *29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 30

1574

Some sources have the eleventh month of this year intercalary, and 天正2年12月1日 = 1575-01-12. Other sources have the last month of this year intercalary, and 天正2年閏12月1日 = 1575-01-13.

1557

According to Tsuchihashi 弘治3年2月1日 was 1557-03-01, according to Zöllner 1557-03-02.

1555

Some sources have a long intercalary month 10, some a short. That means for the last two months, that they start either at 1555-12-14, 1556-1-13 or one day earlier.

Table

Following the format of datenbasis.pdf, we give the above in tabular format. Each line gives the intercalary months, if any, followed by a list of the long months. Different versions for the same year are given on separate lines.
year ic long months
1731 2 4 6 8 9 11
1 4 6 8 9 11
1697 2 2 4 6 8 9 11 12
2 3 5 7 9 11 12
1574 11
12
1 4 7 9 10 11 12
1557 2 5 8 10 11 12
1 5 8 10 11 12
1555 10 1 4 6 8 9 ic10 11
1 4 6 8 9 11 12
In each case, the top line is the best supported version.

References

Date converters

Era lists

Calendars

aeb@cwi.nl