TimeZones

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

Helps work with TimeZones.

Since:

3.7

Fields and constants

static final TimeZone

GMT

The GMT time zone.

static final String

GMT_ID

A public version of 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 TimeZone's package private GMT_ID field.

Methods

static TimeZone

getTimeZone(String id)

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

static TimeZone

toTimeZone(TimeZone 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