Top Description Fields Constructors Methods
org.apache.commons.lang3.time

public Class FastTimeZone

extends Object
Class Inheritance
Imports
java.util.TimeZone, java.util.regex.Matcher, .Pattern

Faster methods to produce custom time zones.
Since
3.7

Field Summary

Modifier and TypeField and Description
private static final Pattern
private static final TimeZone

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static TimeZone

Returns:

A TimeZone with a raw offset of zero.
getGmtTimeZone
()

Gets the GMT TimeZone.

public static TimeZone

Returns:

A TimeZone with offset from GMT or null, if pattern does not match.
getGmtTimeZone
(final String
The GMT offset
pattern
)

Gets a TimeZone with GMT offsets.

public static TimeZone

Returns:

A time zone
getTimeZone
(final String
A GMT custom id (or Olson id
id
)

Gets a TimeZone, looking first for GMT custom ids, then falling back to Olson ids.

private static int
parseInt(final String group)

private static boolean
parseSign(final String group)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GMT_PATTERNback to summary
private static final Pattern GMT_PATTERN
GREENWICHback to summary
private static final TimeZone GREENWICH

Constructor Detail

FastTimeZoneback to summary
private FastTimeZone()

Method Detail

getGmtTimeZoneback to summary
public static TimeZone getGmtTimeZone()

Gets the GMT TimeZone.

Returns:TimeZone

A TimeZone with a raw offset of zero.

getGmtTimeZoneback to summary
public static TimeZone getGmtTimeZone(final String pattern)

Gets a TimeZone with GMT offsets. A GMT offset must be either 'Z', or 'UTC', or match (GMT)? hh?(:?mm?)?, where h and m are digits representing hours and minutes.

Parameters
pattern:String

The GMT offset

Returns:TimeZone

A TimeZone with offset from GMT or null, if pattern does not match.

getTimeZoneback to summary
public static TimeZone getTimeZone(final String id)

Gets a TimeZone, looking first for GMT custom ids, then falling back to Olson ids. A GMT custom id can be 'Z', or 'UTC', or has an optional prefix of GMT, followed by sign, hours digit(s), optional colon(':'), and optional minutes digits. i.e. [GMT] (+|-) Hours [[:] Minutes]

Parameters
id:String

A GMT custom id (or Olson id

Returns:TimeZone

A time zone

parseIntback to summary
private static int parseInt(final String group)
parseSignback to summary
private static boolean parseSign(final String group)