Convertir String
en 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));
}
Convertissez java.util.Date
en java.time.LocalDate
public static LocalDate date2LocalDate(final Date date) {
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
Convertissez java.time.LocalDate
en java.util.Date
public static Date localDate2Date(final LocalDate localDate) {
return Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
}
Recommended Posts