public abstract class TimeZoneProvider
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static TimeZoneProvider[] |
CACHE
A small cache for timezone providers.
|
static TimeZoneProvider |
UTC
The UTC time zone provider.
|
| Constructor and Description |
|---|
TimeZoneProvider() |
| Modifier and Type | Method and Description |
|---|---|
static TimeZoneProvider |
getDefault()
Returns the time zone provider for the system default time zone.
|
abstract long |
getEpochSecondsFromLocal(long dateValue,
long timeNanos)
Calculates the epoch seconds from local date and time.
|
abstract java.lang.String |
getId()
Returns the ID of the time zone.
|
abstract java.lang.String |
getShortId(long epochSeconds)
Get the standard time name or daylight saving time name of the time zone.
|
abstract int |
getTimeZoneOffsetLocal(long dateValue,
long timeNanos)
Calculates the time zone offset in seconds for the specified date value
and nanoseconds since midnight in local time.
|
abstract int |
getTimeZoneOffsetUTC(long epochSeconds)
Calculates the time zone offset in seconds for the specified EPOCH
seconds.
|
boolean |
hasFixedOffset()
Returns whether this is a simple time zone provider with a fixed offset
from UTC.
|
static TimeZoneProvider |
ofId(java.lang.String id)
Returns the time zone provider with the specified name.
|
static TimeZoneProvider |
ofOffset(int offset)
Returns the time zone provider with the specified offset.
|
public static final TimeZoneProvider UTC
public static TimeZoneProvider[] CACHE
public static TimeZoneProvider ofOffset(int offset)
offset - UTC offset in secondspublic static TimeZoneProvider ofId(java.lang.String id) throws java.lang.RuntimeException
id - the ID of the time zonejava.lang.RuntimeException - if time zone with specified ID isn't knownpublic static TimeZoneProvider getDefault()
public abstract int getTimeZoneOffsetUTC(long epochSeconds)
epochSeconds - seconds since EPOCHpublic abstract int getTimeZoneOffsetLocal(long dateValue,
long timeNanos)
dateValue - date valuetimeNanos - nanoseconds since midnightpublic abstract long getEpochSecondsFromLocal(long dateValue,
long timeNanos)
dateValue - date valuetimeNanos - nanoseconds since midnightpublic abstract java.lang.String getId()
public abstract java.lang.String getShortId(long epochSeconds)
epochSeconds - seconds since EPOCHpublic boolean hasFixedOffset()