public static Date localDate2Date(LocalDate localDate) { ZoneId zoneId = ZoneId.systemDefault(); ZonedDateTime zdt = localDate.atStartOfDay(zoneId); return Date.from(zdt.toInstant()); }
public static LocalDate date2LocalDate(Date date) { Instant instant = date.toInstant(); ZoneId zoneId = ZoneId.systemDefault(); // atZone()方法返回在指定時區今後Instant生成的ZonedDateTime。 return instant.atZone(zoneId).toLocalDate(); }