lunar-java
lunar-java copied to clipboard
java公历转农历速度有点慢
我把一个月的公历的全部日子都转换为农历,发现大概需要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
}
tyme速度快得多,可以试下。 https://github.com/6tail/tyme4j