String
を java.time.LocalDate
に変換
static final private String DATE_FORMAT = "yyyy-MM-dd";
public static LocalDate string2LocalDate(final String date) {
return LocalDate.parse(date, DateTimeFormatter.ofPattern(DATE_FORMAT));
}
java.util.Date
を java.time.LocalDate
に変換
public static LocalDate date2LocalDate(final Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
java.time.LocalDate
を java.util.Date
に変換
public static Date localDate2Date(final LocalDate localDate) {
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}