问题:
I have an external API that returns me dates as long
s, represented as milliseconds since the beginning of the Epoch.我有一个外部 API,它返回我作为long
s 的日期,表示为自 Epoch 开始以来的毫秒数。
With the old style Java API, I would simply construct a Date
from it with使用旧式 Java API,我只需从它构造一个Date
Date myDate = new Date(startDateLong)
What is the equivalent in Java 8's LocalDate
/ LocalDateTime
classes? Java 8 的LocalDate
/ LocalDateTime
类中的等价物是什么?
I am interested in converting the point in time represented by the long
to a LocalDate
in my current local timezone.我有兴趣将long
表示的时间点转换为当前本地时区中的LocalDate
。
解决方案:
参考一: https://en.stackoom.com/question/2Nck6参考二: https://stackoom.com/question/2Nck6