Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

月日的干支都错了 #27

Open
JasonBourne33 opened this issue Dec 12, 2022 · 5 comments
Open

月日的干支都错了 #27

JasonBourne33 opened this issue Dec 12, 2022 · 5 comments

Comments

@JasonBourne33
Copy link

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

@bigbiglemon
Copy link

bigbiglemon commented Dec 12, 2022

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

@6tail
Copy link
Owner

6tail commented Dec 12, 2022

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

@JasonBourne33
Copy link
Author

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

@6tail
Copy link
Owner

6tail commented Dec 14, 2022

@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();

@JasonBourne33
Copy link
Author

好的,已经改了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants