Loading
0

LocalDateTime与Date间的转换

Date转LocalDateTime:

Date in = new Date();
LocalDateTime ldt = LocalDateTime.ofInstant(in.toInstant(), ZoneId.systemDefault());

LocalDateTime转Date:

LocalDateTime ldt=LocalDateTime.now();
Date freezeTime = Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant());

最后编辑于:2023/4/24作者: joycode

我不入地狱,谁入地狱?

评论已关闭