LocalDate 转Date
1.需要先将LocalDate转为LocalDateTime
LocalDate.atStartOfDay()
2. 获取 Instance,需要指定时区,这里使用系统默认
LocalDateTime.atZone(ZoneId.systemDefault()).toInstant()
3.转化
Date.from()
连起来就是
Date.from(LocalDate.now().atStartOfDay().atZone(ZoneId.systemDefault()).toInstant())
Date转LocalDate
new Date().toInstant().atZone(ZoneId.systemDefault()).toLocalDate()
7125

被折叠的 条评论
为什么被折叠?



