Java Utililty Methods ZoneId

List of utility methods to do ZoneId

Description

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

Method

ZoneIdgetZoneId(String tzId)
get Zone Id
return ZoneId.of(tzId, ZoneId.SHORT_IDS);
LocalDatenow()
Get localized LocalDate, using Europe / Paris time zone.
return LocalDate.now(EUROPE_PARIS);
ZonedDateTimeparseBuildTimestamp(String buildTimestamp)
parse Build Timestamp
return parseToZonedDateTime(buildTimestamp + " +0000", "yyyy-MM-dd HH:mm Z");
ZonedDateTimeparseDateTime(String yyyymmdd, String hhmmss)
parse Date Time
return parseDateTime(yyyymmdd, hhmmss, ZoneId.systemDefault());
ZonedDateTimeparseDateToZdt(Date date)
parse Date To Zdt
return ZonedDateTime.ofInstant(date.toInstant(), zoneId);
ZoneIdparseTimeZone(String timeZoneStr)
parse Time Zone
if (timeZoneStr == null || timeZoneStr.trim().isEmpty()
        || timeZoneStr.trim().toLowerCase().equals("local")) {
    return ZoneId.systemDefault();
try {
    return ZoneId.of(timeZoneStr);
} catch (DateTimeException e1) {
    throw new RuntimeException("Invalid time zone displacement value");
...
StringslugifyDate(Long epochMillis)
Turns the date into a format that has no spaces, colons, or any other invalid characters invalid for a file name The actual format used is: YYYY-MM-dd-HHmm-ssSS
return slugifyDate(ZonedDateTime.ofInstant(Instant.ofEpochMilli(epochMillis), UTC));
ZoneIdverifyZoneId(String zoneId)
Verifies if the given user zone id is handled by the server.
if (zoneIds.contains(zoneId)) {
    return ZoneId.of(zoneId);
return getDefaultZoneId();
ZoneIdzoneId(Object zoneId)
zone Id
if (zoneId == null) {
    return null;
return zoneId(zoneId.toString());