TimeZones

public class org.apache.commons.lang3.time.TimeZones[source]

Helps work with java.util.TimeZones.

Since:

3.7

Fields and constants

GMT

The GMT time zone.

GMT_ID

A public version of java.util.TimeZone’s package private GMT_ID field.

public static final TimeZone GMT[source]

The GMT time zone.

Since:

3.13.0

public static final String GMT_ID = "GMT"[source]

A public version of java.util.TimeZone’s package private GMT_ID field.

Methods

getTimeZone(String)

Gets the time zone using TimeZone#getTimeZone(String).

toTimeZone(TimeZone)

Returns the given TimeZone if non-null, otherwise TimeZone#getDefault().

public static TimeZone getTimeZone(String id)[source]

Gets the time zone using TimeZone#getTimeZone(String). On Java 25 and later, maps IDs found 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".

Parameters:

id – Same as TimeZone#getTimeZone(String).

Returns:

Same as TimeZone#getTimeZone(String).

Since:

3.20.0

public static TimeZone toTimeZone(TimeZone timeZone)[source]

Returns the given TimeZone if non-null, otherwise TimeZone#getDefault().

Parameters:

timeZone – A locale or null.

Returns:

The given locale if non-null, otherwise TimeZone#getDefault().

Since:

3.13.0