Class TimeZones
java.lang.Object
org.apache.commons.lang3.time.TimeZones
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic TimeZonegetTimeZone(String id) Gets the time zone usingTimeZone.getTimeZone(String).static TimeZonetoTimeZone(TimeZone timeZone) Returns the given TimeZone if non-null, otherwiseTimeZone.getDefault().
-
Field Details
-
GMT_ID
-
GMT
-
-
Method Details
-
getTimeZone
Gets the time zone usingTimeZone.getTimeZone(String). On Java 25 and later, maps IDs found inZoneId.SHORT_IDS.On Java 25, calling
TimeZone.getTimeZone(String)with an ID inZoneId.SHORT_IDSwrites a message toSystem.errin 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_IDSby setting the system property"TimeZones.mapShortIDs=false".- Parameters:
id- Same asTimeZone.getTimeZone(String).- Returns:
- Same as
TimeZone.getTimeZone(String). - Since:
- 3.20.0
-
toTimeZone
Returns the given TimeZone if non-null, otherwiseTimeZone.getDefault().- Parameters:
timeZone- A locale ornull.- Returns:
- The given locale if non-
null, otherwiseTimeZone.getDefault(). - Since:
- 3.13.0
-