MeridianMERIDIAN

Japanese Imperial Year (Long/Kanji)

datetime.date.jp_era_long

Full Japanese era name in kanji followed by year, month, day with Chinese-style character delimiters. Used in formal Japanese government and legal documents.

Operations on this type: Parse nested values

Try a value

Japanese Imperial Year (Long/Kanji)'s rule accepts it.

Reads it as 2024-01-15

Use it

Shell
finetype infer -i '令和6年1月15日' --mode column
# → datetime.date.jp_era_long
DuckDB
SELECT ft_infer('令和6年1月15日');
-- → 'datetime.date.jp_era_long'
Cast template: {col} is your column
CASE
  WHEN {col} LIKE '令和%' THEN make_date(2018 + CAST(regexp_extract({col}, '(\d+)年', 1) AS INT), CAST(regexp_extract({col}, '(\d+)月', 1) AS INT), CAST(regexp_extract({col}, '(\d+)日', 1) AS INT))
  WHEN {col} LIKE '平成%' THEN make_date(1988 + CAST(regexp_extract({col}, '(\d+)年', 1) AS INT), CAST(regexp_extract({col}, '(\d+)月', 1) AS INT), CAST(regexp_extract({col}, '(\d+)日', 1) AS INT))
  WHEN {col} LIKE '昭和%' THEN make_date(1925 + CAST(regexp_extract({col}, '(\d+)年', 1) AS INT), CAST(regexp_extract({col}, '(\d+)月', 1) AS INT), CAST(regexp_extract({col}, '(\d+)日', 1) AS INT))
  WHEN {col} LIKE '大正%' THEN make_date(1911 + CAST(regexp_extract({col}, '(\d+)年', 1) AS INT), CAST(regexp_extract({col}, '(\d+)月', 1) AS INT), CAST(regexp_extract({col}, '(\d+)日', 1) AS INT))
  WHEN {col} LIKE '明治%' THEN make_date(1867 + CAST(regexp_extract({col}, '(\d+)年', 1) AS INT), CAST(regexp_extract({col}, '(\d+)月', 1) AS INT), CAST(regexp_extract({col}, '(\d+)日', 1) AS INT))
END

How finetype reads the samples

DuckDB 1.5.5 · finetype 0.6.66

ValueAs DATEera_nameera_year
令和6年1月15日2024-01-15令和6
平成31年4月30日2019-04-30平成31
昭和64年1月7日1989-01-07昭和64

Pattern

Regular expression
^(令和|平成|昭和|大正|明治)\d{1,2}年\d{1,2}月\d{1,2}日$
ValueLengthShape
令和6年1月15日9matches
平成31年4月30日10matches
昭和64年1月7日9matches
令和6年1月158rejected: one character short

Background

Origin

Japan's Era Name Law, 元号法, is Law No. 43 of Showa 54 (昭和五十四年法律第四十三号).[1] The Era Name Law became law in 1979.[2] The Era Name Law provides that era names are set by Cabinet Order (元号は、政令で定める。).[1] The Era Name Law provides that an era name is changed only when there is a succession to the imperial throne (元号は、皇位の継承があつた場合に限り改める。).[1] The Cabinet Order that changed the era to Reiwa, 元号を改める政令, was made under the first paragraph of the Era Name Law.[3] The Reiwa era began on 1 May 2019, the day of Naruhito's accession to the throne.[2]

Microsoft's .NET documentation describes the Japanese calendar, also known as the Wareki calendar, as working exactly like the Gregorian calendar except that the year and era are different.[4] Java's documentation says the Japanese Imperial calendar system is the same as the ISO calendar system apart from the era-based year numbering.[5] The .NET JapaneseCalendar class numbers five eras: 明治 (Meiji), 大正 (Taisho), 昭和 (Showa), 平成 (Heisei) and 令和 (Reiwa).[4] Microsoft's .NET documentation gives the Showa era as running from December 25, 1926 to January 7, 1989.[4] Microsoft's .NET documentation gives the Heisei era as running from January 8, 1989 to April 30, 2019.[4] Java's documentation maps 7 January Showa 64 to ISO 1989-01-07 and 8 January Heisei 1 to ISO 1989-01-08.[5] The Japanese imperial year increments on January 1, just like the Gregorian year, not on the anniversary of the emperor's enthronement.[6]

Use

Japanese government offices usually require era names and years for official papers.[2] Much domestic and regional government paperwork in Japan retains the Japanese year.[6]

Microsoft's .NET blog warns that you can't be certain that a future date will always belong to the current era.[7] Microsoft's .NET documentation says a change of era affects all applications that use its Japanese calendars.[4] The .NET blog notes that, with strict era range checking, future dates that are valid before an era change may become invalid after the era change.[7] The .NET blog advises always formatting a date value with its era, because dates can be ambiguous.[7] When a year runs past the end of its era, ask whether the date was written before the era changed before you treat it as an error. (Meridian's view) Convert these dates to ISO 8601 as early as you can, mapping each era name to its own Gregorian offset, and keep the original string beside the converted date. (Meridian's view)

Where you'll meet it

Japan's Digital Agency dates the file releases on its page of local-government open-data survey results in era form with the Gregorian year in brackets, as in 令和7年(2025年)2月10日公開.[8]

How it's detected

Formal Japanese imperial year with kanji era names. Transform maps era names to gregorian year offsets.

Schema

https://meridian.online/schemas/datetime.date.jp_era_long · Frictionless type string

finetype taxonomy datetime.date.jp_era_long -o json-schema

Aliases

wareki_long

Type Registry