Skip to content

Instantly share code, notes, and snippets.

@Altech
Created April 22, 2019 05:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Altech/5ed2e493b096d9ca6b8849eb853abd98 to your computer and use it in GitHub Desktop.
Save Altech/5ed2e493b096d9ca6b8849eb853abd98 to your computer and use it in GitHub Desktop.
西暦から和暦を出す Notion Formula
// https://www.benricho.org/nenrei/sei-gen.all.html
// notion formula
if(prop("西暦") < 1532,
"未定義(<1532)",
if(prop("西暦") <= 1555,
concat("天文", format(subtract(add(prop("西暦"), 1),1532)), "年"),
if(prop("西暦") <= 1558,
concat("弘治", format(subtract(add(prop("西暦"), 1),1555)), "年"),
if(prop("西暦") <= 1570,
concat("永禄", format(subtract(add(prop("西暦"), 1),1558)), "年"),
if(prop("西暦") <= 1573,
concat("元亀", format(subtract(add(prop("西暦"), 1),1570)), "年"),
if(prop("西暦") <= 1593,
concat("天正", format(subtract(add(prop("西暦"), 1),1573)), "年"),
if(prop("西暦") <= 1596,
concat("文禄", format(subtract(add(prop("西暦"), 1),1593)), "年"),
if(prop("西暦") <= 1615,
concat("慶長", format(subtract(add(prop("西暦"), 1),1596)), "年"),
if(prop("西暦") <= 1624,
concat("元和", format(subtract(add(prop("西暦"), 1),1615)), "年"),
"未定義(>1624)"
)
)
)
)
)
)
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment