Package org.apache.commons.lang3.time
Class TimeZones
- java.lang.Object
-
- org.apache.commons.lang3.time.TimeZones
-
public class TimeZones extends java.lang.ObjectHelps dealing withTimeZones.- Since:
- 3.7
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.TimeZonegetTimeZone(java.lang.String id)Delegates toTimeZone.getTimeZone(String), on Java 25 and up, maps an ID if it's a key inZoneId.SHORT_IDS.static java.util.TimeZonetoTimeZone(java.util.TimeZone timeZone)Returns the given TimeZone if non-null, otherwiseTimeZone.getDefault().
-
-
-
Field Detail
-
GMT_ID
public static final java.lang.String GMT_ID
A public version ofTimeZone's package privateGMT_IDfield.- See Also:
- Constant Field Values
-
GMT
public static final java.util.TimeZone GMT
The GMT time zone.- Since:
- 3.13.0
-
-
Method Detail
-
getTimeZone
public static java.util.TimeZone getTimeZone(java.lang.String id)
Delegates toTimeZone.getTimeZone(String), on Java 25 and up, maps an ID if it's a key 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
public static java.util.TimeZone toTimeZone(java.util.TimeZone timeZone)
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
-
-