Java Utililty Methods ZonedDateTime Create

List of utility methods to do ZonedDateTime Create

Description

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

Method

ZonedDateTimetoZonedDateTime(@Nullable Date date, @Nullable TimeZone zone)
Convert the given Date to a ZonedDateTime at the given TimeZone
if (date == null || zone == null)
    return null;
return ZonedDateTime.ofInstant(date.toInstant(), zone.toZoneId());
ZonedDateTimetoZonedDateTime(Date utilDate)
to Zoned Date Time
if (utilDate == null) {
    return null;
final ZoneId systemDefault = ZoneId.systemDefault();
return ZonedDateTime.ofInstant(utilDate.toInstant(), systemDefault);
ZonedDateTimetoZonedDateTime(long epochSeconds)
to Zoned Date Time
Instant instant = Instant.ofEpochSecond(epochSeconds);
ZonedDateTime datetime = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
return datetime;
ObjecttoZonedDateTime(long systemMillis)
Return the system millis time as a ZonedDateTime.
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(systemMillis), ZoneId.systemDefault());
ZonedDateTimetoZonedDateTime(Object cell)
to Zoned Date Time
return ZonedDateTime.ofInstant(Instant.ofEpochMilli(toLong(cell)), ZoneId.systemDefault());
ZonedDateTimezonedDateTime(String date, ZoneId zoneId)
zoned Date Time
return ZonedDateTime.of(LocalDateTime.parse(date, formatter), zoneId);
ZonedDateTimezonedDateTimeOf(final ZonedDateTime time)
Utility for creating a ZonedDateTime object from a ZonedDateTime.
return ZonedDateTime.from(time);
StringzonedDateTimeToYyyyMMdd(LocalDate localDate)
zoned Date Time To Yyyy M Mdd
if (localDate == null) {
    return null;
return localDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));