lunar-java icon indicating copy to clipboard operation
lunar-java copied to clipboard

月日的干支都错了

Open JasonBourne33 opened this issue 3 years ago • 5 comments

月日的干支都错了,正确应该是 壬寅年 辛亥月 甲申日 image image image

JasonBourne33 avatar Dec 12 '22 03:12 JasonBourne33

@JasonBourne33 你用的方法是“传入指定农历年月日获取农历”,所以你得到了冬月二七的干支…… 而你提到的正确干支是公历11月27的 -----来自长期使用该库,并定期的来更新的一位开发

bigbiglemon avatar Dec 12 '22 07:12 bigbiglemon

楼上的朋友指出问题关键,你用错方法了,请注意看下文档。 @JasonBourne33

6tail avatar Dec 12 '22 12:12 6tail

可以了,谢谢,应该这样用 image

JasonBourne33 avatar Dec 14 '22 02:12 JasonBourne33

@JasonBourne33 不建议这样重复多次调用solar.getLunar(),每调用一次getLunar(),都会重新计算一次,运行效率太低。应该这样使用:

Solar solar = Solar.fromYmdHms(year, month, day, hour, 0, 0);
Lunar lunar = solar.getLunar();
String yearInGanZhi = lunar.getYearInGanZhi();
String monthInGanZhi = lunar.getMonthInGanZhi();

6tail avatar Dec 14 '22 10:12 6tail

好的,已经改了

JasonBourne33 avatar Dec 28 '22 06:12 JasonBourne33