- 通过注解
@JsonSerialize(using = JsonDateSerializer.class)
- 通过
Date.from(localDateTime.toInstant(ZoneOffset.of("+8")));
- 通过
Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());
实现localDateTime转Date的方法
于 2022-12-02 09:48:11 首次发布
@JsonSerialize(using = JsonDateSerializer.class)
Date.from(localDateTime.toInstant(ZoneOffset.of("+8")));
Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant());