Instant instant = ...;
String out = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(instant);
想要通过使用Jdk1.8的时间Api来进行格式化Instant到字符串,该怎么实现呢??
苦尽脑汁想出来的上述代码实现,发现报了异常
java.time.temporal.UnsupportedTemporalTypeException: Unsupported field: YearOfEra
at java.time.Instant.getLong(Instant.java:608)
at java.time.format.DateTimePrintContext.getValue(DateTimePrintContext.java:298)