我可以看到如何从LocalDate
转换为纪元日期,但我该如何反过来呢?
也就是说,如果我有从纪元开始的天数,我该如何构建org.joda.time.LocalDate
?
答案 0 :(得分:3)
简单:
// You'd probably make this a constant somewhere
LocalDate epoch = new LocalDate(1970, 1, 1);
LocalDate desiredDate = epoch.plusDays(daysSinceEpoch);
答案 1 :(得分:1)
构建一个新的j ava.util.Date,然后将其传递给LocalDate Constructor