如何初始化一个实例类型?
我尝试过这样做:
Instant instant = new Instant();
但是它不起作用...
我需要它,因为在Freemarker上完成后,我必须这样做:
[#assign dateFormated = newDate.from(instant.ofEpochSecond(data.time.seconds))/]
如何初始化一个实例类型?
我尝试过这样做:
Instant instant = new Instant();
[#assign dateFormated = newDate.from(instant.ofEpochSecond(data.time.seconds))/]
java.util.Date
? - Jasper de VriesDate
已经过时(无意冒犯),设计不佳,大多数方法和构造函数都已被弃用,因为它们在不同的时区中不可靠。它非常明显是来自另一个千年的技术。java.time
是现代Java日期和时间API,Instant
属于其中,使用起来更加舒适。 - Ole V.V.instant.ofEpoch...
... 我假设你调用了静态方法,但那么应该是Instant.ofEpoch...
吧?! - GhostCat