/**
* date转 localdate
*
* @param date
* @return
*/
private static LocalDate dateToLocalDate(Date date) {
logger.info("date转 localdate" + date);
if (null == date) {
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
/**
* localdate 转 date
*
* @param localDate
* @return
*/
private static Date localDateToDate(LocalDate localDate) {
logger.info(" localdate 转 date" + localDate);
if (null == localDate) {
return null;
}
ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
return Date.from(zonedDateTime.toInstant());
}
dateToLocalDate/localDateToDate
原文:https://www.cnblogs.com/xiaoshahai/p/13813289.html