Edited at

String、Date、LocalDateの変換

More than 1 year has passed since last update.

Stringjava.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.Datejava.time.LocalDate に変換

public static LocalDate date2LocalDate(final Date date) {

return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}

java.time.LocalDatejava.util.Date に変換

public static Date localDate2Date(final LocalDate localDate) {

return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}