JAVA Date与LocalDate互转

//LocalDate转Date
LocalDate nowLocalDate = LocalDate.now();
ZonedDateTime zonedDateTime = nowLocalDate.atStartOfDay(ZoneId.systemDefault());
 Date srmProductDate =  Date.from(zonedDateTime.toInstant());
//Date转LocalDate
Date date = new Date();
LocalDate nowLocalDate =  date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();

 

posted @ 2021-06-03 17:01  哎丫丫呀喂  阅读(2307)  评论(0编辑  收藏  举报