public abstract class TimeZoneProvider extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
static TimeZoneProvider[] |
CACHE
A small cache for timezone providers.
|
static TimeZoneProvider |
UTC
The UTC time zone provider.
|
| 构造器和说明 |
|---|
TimeZoneProvider() |
| 限定符和类型 | 方法和说明 |
|---|---|
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 String |
getId()
Returns the ID of the time zone.
|
abstract 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(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(String id) throws RuntimeException
id - the ID of the time zoneRuntimeException - 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 String getId()
public abstract String getShortId(long epochSeconds)
epochSeconds - seconds since EPOCHpublic boolean hasFixedOffset()
Copyright © 2022. All rights reserved.