網路城邦
上一篇 回創作列表 下一篇   字體:
[曆法] 國曆農曆換算資料
2012/10/29 03:10:00瀏覽1644|回應0|推薦0


網路上常見之萬年曆,其國曆與農曆換算方式,都以對照表為主。
雖然農曆換算沒有簡單的規則,但是國曆農曆的日期是一對一相互對應的,因此可從某一起算日開始使用對照表將國曆農曆日期相互做轉換。

註:本篇文章為探討國曆農曆的換算資料,而非國曆農曆的日期換算。
  若要查詢國曆農曆的日期換算,請參考萬年曆與農民曆



下列資料是林洵賢先生的 DHTML 農曆月曆萬年曆中之農曆資料對照表,並附加說明。
此萬年曆在網路上流傳甚廣,但很多都把原作者資訊移除。

# 用16進位儲存 1900-2100 年之農曆資料陣列
# 起算日為國曆1900年01月31日即農曆1900年元月初一
# 以 2進位檢視元素資料
# 16~5bit 儲存全年農曆月份之大小月,1 為大月30天,0 為小月29天
#  4~1bit 儲存農曆閏月月份,f 表示前一年閏年為大月30天,0 為小月29天
@lunarInfo = (0x4bd8, #1900
0x4ae0,0xa570,0x54d5,0xd260,0xd950,0x5554,0x56af,0x9ad0,0x55d2,0x4ae0, # 1910
0xa5b6,0xa4d0,0xd250,0xd295,0xb54f,0xd6a0,0xada2,0x95b0,0x4977,0x497f, # 1920
0xa4b0,0xb4b5,0x6a50,0x6d40,0xab54,0x2b6f,0x9570,0x52f2,0x4970,0x6566, # 1930
0xd4a0,0xea50,0x6a95,0x5adf,0x2b60,0x86e3,0x92ef,0xc8d7,0xc95f,0xd4a0, # 1940
0xd8a6,0xb55f,0x56a0,0xa5b4,0x25df,0x92d0,0xd2b2,0xa950,0xb557,0x6ca0, # 1950
0xb550,0x5355,0x4daf,0xa5b0,0x4573,0x52bf,0xa9a8,0xe950,0x6aa0,0xaea6, # 1960
0xab50,0x4b60,0xaae4,0xa570,0x5260,0xf263,0xd950,0x5b57,0x56a0,0x96d0, # 1970
0x4dd5,0x4ad0,0xa4d0,0xd4d4,0xd250,0xd558,0xb540,0xb6a0,0x95a6,0x95bf, # 1980
0x49b0,0xa974,0xa4b0,0xb27a,0x6a50,0x6d40,0xaf46,0xab60,0x9570,0x4af5, # 1990
0x4970,0x64b0,0x74a3,0xea50,0x6b58,0x5ac0,0xab60,0x96d5,0x92e0,0xc960, # 2000
0xd954,0xd4a0,0xda50,0x7552,0x56a0,0xabb7,0x25d0,0x92d0,0xcab5,0xa950, # 2010
0xb4a0,0xbaa4,0xad50,0x55d9,0x4ba0,0xa5b0,0x5176,0x52bf,0xa930,0x7954, # 2020
0x6aa0,0xad50,0x5b52,0x4b60,0xa6e6,0xa4e0,0xd260,0xea65,0xd530,0x5aa0, # 2030
0x76a3,0x96d0,0x4afb,0x4ad0,0xa4d0,0xd0b6,0xd25f,0xd520,0xdd45,0xb5a0, # 2040
0x56d0,0x55b2,0x49b0,0xa577,0xa4b0,0xaa50,0xb255,0x6d2f,0xada0,0x4b63, # 2050
0x937f,0x49f8,0x4970,0x64b0,0x68a6,0xea5f,0x6b20,0xa6c4,0xaaef,0x92e0, # 2060
0xd2e3,0xc960,0xd557,0xd4a0,0xda50,0x5d55,0x56a0,0xa6d0,0x55d4,0x52d0, # 2070
0xa9b8,0xa950,0xb4a0,0xb6a6,0xad50,0x55a0,0xaba4,0xa5b0,0x52b0,0xb273, # 2080
0x6930,0x7337,0x6aa0,0xad50,0x4b55,0x4b6f,0xa570,0x54e4,0xd260,0xe968, # 2090
0xd520,0xdaa0,0x6aa6,0x56df,0x4ae0,0xa9d4,0xa4d0,0xd150,0xf252,0xd520, # 2100
);



下列資料為另一種之農曆資料對照表,並附加說明。此對照表在網路上也流傳甚廣,目前看到最早版本據信為黃曉鳴先生所寫。

# 儲存 1936-2031 年之農曆資料陣列
# 起算日為每年的國曆1月1日
# d = 該年國曆 1 月 1 日到農曆正月初一的累積日數
# i = 該年之閏月月份, 0 為該年沒有閏月
# W = 該年國曆 1 月 1 日為星期幾再減 1
# k = 該年國曆 1 月 1 日之干支序號減 1
# m1~m13 = 該年全年農曆月份之大小月,1 為大月30天,0 為小月29天
# 若該年無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, 0, 1 ],
[ 28, 6, 2,  5, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0 ], # 2025
[ 47, 0, 3, 10, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1 ],
[ 36, 0, 4, 15, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1 ],
[ 25, 5, 5, 20, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0 ],
[ 43, 0, 0, 26, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 ],
[ 32, 0, 1, 31, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0 ], # 2030
[ 22, 3, 2, 36, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0 ],
);
( 知識學習其他 )
回應 推薦文章 列印 加入我的文摘
上一篇 回創作列表 下一篇

引用
引用網址:https://classic-blog.udn.com/article/trackback.jsp?uid=bensonhong&aid=6993810