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

java公历转农历速度有点慢

Open Maikscau opened this issue 2 years ago • 1 comments

我把一个月的公历的全部日子都转换为农历,发现大概需要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
}

Maikscau avatar Jun 30 '23 02:06 Maikscau

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

6tail avatar Jun 06 '24 13:06 6tail