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

java公历转农历速度有点慢 #35

Open
Maikscau opened this issue Jun 30, 2023 · 1 comment
Open

java公历转农历速度有点慢 #35

Maikscau opened this issue Jun 30, 2023 · 1 comment

Comments

@Maikscau
Copy link

Maikscau commented Jun 30, 2023

我把一个月的公历的全部日子都转换为农历,发现大概需要1.5-2秒,感觉有点慢,不知道是不是使用的方式不对?
语法是kotlin,我单独测试过Date.from(day.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())这个是不耗时的

val lunarDate = Lunar.fromDate(Date.from(day.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()))
val subText = if (lunarDate.day == 1) {
    lunarDate.monthInChinese + ""
} else {
    lunarDate.dayInChinese
}
@6tail
Copy link
Owner

6tail commented Jun 6, 2024

tyme速度快得多,可以试下。
https://github.com/6tail/tyme4j

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

2 participants