## 干支 10天干和12地支结合,形成60个干支为一轮回,即60甲子。如辛亥即天干
辛
与地支
亥
的组合。 60甲子的排列顺序为:
序号
干支
序号
干支
序号
干支
序号
干支
序号
干支
1
甲子
13
丙子
25
戊子
37
庚子
49
壬子
2
乙丑
14
丁丑
26
己丑
38
辛丑
50
癸丑
3
丙寅
15
戊寅
27
庚寅
39
壬寅
51
甲寅
4
丁卯
16
己卯
28
辛卯
40
癸卯
52
乙卯
5
戊辰
17
庚辰
29
壬辰
41
甲辰
53
丙辰
6
己巳
18
辛巳
30
癸巳
42
乙巳
54
丁巳
7
庚午
19
壬午
31
甲午
43
丙午
55
戊午
8
辛未
20
癸未
32
乙未
44
丁未
56
己未
9
壬申
21
甲申
33
丙申
45
戊申
57
庚申
10
癸酉
22
乙酉
34
丁酉
46
己酉
58
辛酉
11
甲戌
23
丙戌
35
戊戌
47
庚戌
59
壬戌
12
乙亥
24
丁亥
36
己亥
48
辛亥
60
癸亥
年、月、日、时辰都可以使用干支来表示。 1. .getYearInGanZhi() > 获取干支纪年(新年以正月初一起算) 2. .getYearGan() > 获取阴历年的天干(新年以正月初一起算) 3. .getYearZhi() > 获取阴历年的地支(新年以正月初一起算) 4. .getMonthInGanZhi() > 获取干支纪月(新的一月以节交接当天零点起算) 5. .getMonthGan() > 获取阴历月的天干(新的一月以节交接当天零点起算) 6. .getMonthZhi() > 获取阴历月的地支(新的一月以节交接当天零点起算) 7. .getDayInGanZhi() > 获取干支纪日 8. .getDayGan() > 获取阴历日的天干 9. .getDayZhi() > 获取阴历日的地支 10. .getTimeInGanZhi() > 获取干支纪时 11. .getTimeGan() > 获取时辰的天干 12. .getTimeZhi() > 获取时辰的地支 13. .getGan() > [已过时] 获取年天干,为兼容老版本而保留,等同于getYearGan 14. .getZhi() > [已过时] 获取年地支,为兼容老版本而保留,等同于getYearZhi 由于国标农历新年是以正月初一起算,而民间很多时候是以立春开始算,算八字则更需要精确到以节交接的时刻,所以提供更多的方法。 1. .getYearInGanZhiByLiChun() > 获取干支纪年(新年以立春零点起算) 2. .getYearGanByLiChun() > 获取阴历年的天干(新年以立春零点起算) 3. .getYearZhiByLiChun() > 获取阴历年的地支(新年以立春零点起算) 4. .getYearInGanZhiExact() > 获取干支纪年(新年以立春节气交接的时刻起算) 5. .getYearGanExact() > 获取阴历年的天干(新年以立春节气交接的时刻起算) 6. .getYearZhiExact() > 获取阴历年的地支(新年以立春节气交接的时刻起算) 例如立春时刻为14:30:02,则可能导致一天中上午属于上一年,下午属于下一年,尤其是计算八字时需要如此精确的划分,否则失之毫厘谬以千里。 月份则相对更统一一些,都是以节交接作为月份分隔的依据,但是计算八字也需要精确到时刻。 1. .getMonthInGanZhiExact() > 获取干支纪月(新的一月以节交接准确时刻起算) 2. .getMonthGanExact() > 获取阴历月的天干(新的一月以节交接准确时刻起算) 3. .getMonthZhiExact() > 获取阴历月的地支(新的一月以节交接准确时刻起算) 由于八字计算涉及到早子时(00:00-00:59)和晚子时(23:00-23:59),由于晚子时的日干支存在争议,所以日天干和日地支需要按不同的流派来更准确的表示。 1. .getDayInGanZhiExact() > 获取精确的干支纪日(流派1,晚子时日柱算明天) 2. .getDayGanExact() > 获取阴历日的精确天干(流派1,晚子时日柱算明天) 3. .getDayZhiExact() > 获取阴历日的精确地支(流派1,晚子时日柱算明天) 4. .getDayInGanZhiExact2() > 获取精确的干支纪日(流派2,晚子时日柱算当天) 5. .getDayGanExact2() > 获取阴历日的精确天干(流派2,晚子时日柱算当天) 6. .getDayZhiExact2() > 获取阴历日的精确地支(流派2,晚子时日柱算当天) 注:八字计算建议使用[EightChar](lunar.bazi.html) ### 示例代码 var d = Lunar.fromDate(new Date()); console.log('阴历年:'+d.getYear()); console.log('阴历月:'+d.getMonth()); console.log('阴历日:'+d.getDay()); //以正月初一起 console.log('年天干:'+d.getYearGan()); console.log('年地支:'+d.getYearZhi()); console.log('年干支:'+d.getYearInGanZhi()); //以立春当天起 console.log('年天干:'+d.getYearGanByLiChun()); console.log('年地支:'+d.getYearZhiByLiChun()); console.log('年干支:'+d.getYearInGanZhiByLiChun()); //以立春交接时刻起 console.log('年天干:'+d.getYearGanExact()); console.log('年地支:'+d.getYearZhiExact()); console.log('年干支:'+d.getYearInGanZhiExact()); //以节交接当天起 console.log('月天干:'+d.getMonthGan()); console.log('月地支:'+d.getMonthZhi()); console.log('月干支:'+d.getMonthInGanZhi()); //以节交接时刻起 console.log('月天干:'+d.getMonthGanExact()); console.log('月地支:'+d.getMonthZhiExact()); console.log('月干支:'+d.getMonthInGanZhiExact()); console.log('日天干:'+d.getDayGan()); console.log('日地支:'+d.getDayZhi()); console.log('日干支:'+d.getDayInGanZhi()); console.log('时辰天干:'+d.getTimeGan()); console.log('时辰地支:'+d.getTimeZhi()); console.log('时辰干支:'+d.getTimeInGanZhi()); ### 输出