public class TimeZoneUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static TimeZone |
GMT
The GMT time zone.
|
static String |
GMT_ID
A public version of
TimeZone's package private GMT_ID field. |
| Constructor and Description |
|---|
TimeZoneUtil() |
| Modifier and Type | Method and Description |
|---|---|
static TimeZone |
getTimeZone(String id)
Delegates to
TimeZone.getTimeZone(String) after mapping an ID if it's in ZoneId.SHORT_IDS. |
static TimeZone |
toTimeZone(TimeZone timeZone)
Returns the given TimeZone if non-
null, otherwise TimeZone.getDefault(). |
public static final String GMT_ID
TimeZone's package private GMT_ID field.public static final TimeZone GMT
public static TimeZone getTimeZone(String id)
TimeZone.getTimeZone(String) after mapping an ID if it's in ZoneId.SHORT_IDS.
On Java 25, calling TimeZone.getTimeZone(String) with an ID in ZoneId.SHORT_IDS writes a message to System.err in the form:
WARNING: Use of the three-letter time zone ID "the-short-id" is deprecated and it will be removed in a future release
You can disable mapping from ZoneId.SHORT_IDS by setting the system property "TimeZones.mapShortIDs=false".
id - Same as TimeZone.getTimeZone(String).TimeZone.getTimeZone(String).public static TimeZone toTimeZone(TimeZone timeZone)
null, otherwise TimeZone.getDefault().timeZone - a locale or null.null, otherwise TimeZone.getDefault().Copyright © 2026. All rights reserved.