Skip to content

Instantly share code, notes, and snippets.

@nightire
Created June 25, 2013 12:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nightire/5857949 to your computer and use it in GitHub Desktop.
Save nightire/5857949 to your computer and use it in GitHub Desktop.
公历年份转换为中国纪元(天干地支)的方法

公历年份转换为中国纪元(天干地支)的方法

1. 为天干编码

0 1 2 3 4 5 6 7 8 9

凡是公元后年份,减4后除10取余,即得该年天干名称。

1911年41907,除10得余数7,则该年天干名称为

2. 为地支编码

0 1 2 3 4 5 6 7 8 9 10 11

凡是公元后年份,减4后除12取余,即得该年地支名称。

1911年41907,除12得余数11,则该年地支名称为

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment