public static String format(Date date, String pattern) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
LocalDateTime localDateTime = dateToLocalDateTime(date);
return localDateTime.format(dateTimeFormatter);
}
public static Date parse(String date, String pattern) {
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
LocalDateTime localDate = LocalDateTime.parse(date, dateTimeFormatter);
ZoneId zone = ZoneId.systemDefault();
ZonedDateTime dateTime = localDate.atZone(zone);
return Date.from(dateTime.toInstant());
}