Java Utililty Methods ZonedDateTime Format

List of utility methods to do ZonedDateTime Format

Description

The list of methods to do ZonedDateTime Format are organized into topic(s).

Method

ZonedDateTimeparseZonedDateTime(String s, DateTimeFormatter dtf)
parse Zoned Date Time
DateTimeFormatter f = dtf.withResolverStyle(ResolverStyle.STRICT);
LocalDateTime ldt;
if (dtf == UUUU_MM_DD) {
    LocalDate ld = LocalDate.parse(s, f);
    LocalTime lt = LocalTime.of(0, 0, 0);
    ldt = LocalDateTime.of(ld, lt);
} else {
    ldt = LocalDateTime.parse(s, f);
...
StringtoStringExcelFormat(ZonedDateTime date)
to String Excel Format
if (date == null)
    return "";
return DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss").format(date);
ZonedDateTimetoZonedDateTime(String date, DateTimeFormatter formatter)
to Zoned Date Time
try {
    return ZonedDateTime.parse(date, formatter);
} catch (Exception e) {
    throw new IllegalArgumentException(e);