DthingApi
|
Public Member Functions | |
Object | clone () |
String | getID () |
int | getDSTSavings () |
int | getOffset (long time) |
abstract int | getOffset (int era, int year, int month, int day, int dayOfWeek, int timeOfDayMillis) |
abstract int | getRawOffset () |
boolean | hasSameRules (TimeZone timeZone) |
abstract boolean | inDaylightTime (Date time) |
void | setID (String id) |
abstract void | setRawOffset (int offsetMillis) |
abstract boolean | useDaylightTime () |
Static Public Member Functions | |
static synchronized String [] | getAvailableIDs () |
static synchronized String [] | getAvailableIDs (int offsetMillis) |
static synchronized TimeZone | getDefault () |
static native String | getDefaultId () |
static synchronized TimeZone | getTimeZone (String id) |
static synchronized void | setDefault (TimeZone timeZone) |
Static Public Attributes | |
static final int | SHORT = 0 |
static final int | LONG = 1 |
represents a time zone, primarily used for configuring a Calendar or java.text.SimpleDateFormat instance.
Most applications will use getDefault which returns a
based on the time zone where the program is running.
You can also get a specific
It is highly unlikely you'll ever want to use anything but the factory methods yourself. Let classes like Calendar and java.text.SimpleDateFormat do the date computations for you.
If you do need to do date computations manually, there are two common cases to take into account:
Note the type returned by the factory methods getDefault and getTimeZone is implementation dependent. This may introduce serialization incompatibility issues between different implementations. Android returns instances of SimpleTimeZone so that the bytes serialized by Android can be deserialized successfully on other implementations, but the reverse compatibility cannot be guaranteed.
|
inline |
Returns a new time zone with the same ID, raw offset, and daylight savings time rules as this time zone.
|
inlinestatic |
Returns the system's installed time zone IDs. Any of these IDs can be passed to getTimeZone to lookup the corresponding time zone instance. Currently only support
ids.
|
inlinestatic |
Returns the IDs of the time zones whose offset from UTC is
. Any of these IDs can be passed to getTimeZone to lookup the corresponding time zone instance.
|
inlinestatic |
Returns the user's preferred time zone. This may have been overridden for this process with setDefault.
Since the user's time zone changes dynamically, avoid caching this value. Instead, use this method to look it up for each use.
|
static |
|
inline |
Returns the daylight savings offset in milliseconds for this time zone. The base implementation returns
(1 hour) for time zones that use daylight savings time and
for timezones that do not. Subclasses should override this method for other daylight savings offsets.
Note that this method doesn't tell you whether or not to apply the offset: you need to call
for the specific time you're interested in. If this method returns a non-zero offset, that only tells you that this
sometimes observes daylight savings.
|
inline |
Returns the ID of this
, such as
,
or
.
|
inline |
Returns the offset in milliseconds from UTC for this time zone at
. The offset includes daylight savings time if the specified date is within the daylight savings time period.
time | the date in milliseconds since January 1, 1970 00:00:00 UTC |
|
abstract |
Returns this time zone's offset in milliseconds from UTC at the specified date and time. The offset includes daylight savings time if the date and time is within the daylight savings time period.
This method is intended to be used by Calendar to compute Calendar#DST_OFFSET and Calendar#ZONE_OFFSET. Application code should have no reason to call this method directly. Each parameter is interpreted in the same way as the corresponding
field. Refer to Calendar for specific definitions of this method's parameters.
|
abstract |
Returns the offset in milliseconds from UTC of this time zone's standard time.
|
inlinestatic |
Returns a
suitable for
, or
on failure.
An id can be an Olson name of the form Area/Location, such as
. The getAvailableIDs method returns the supported names.
This method can also create a custom
using the following syntax:
. For example,
would return an object with a raw offset of +14 hours from UTC, and which does not use daylight savings. These are rarely useful, because they don't correspond to time zones actually in use.
Other than the special cases "UTC" and "GMT" (which are synonymous in this context, both corresponding to UTC), Android does not support the deprecated three-letter time zone IDs used in Java 1.1.
|
inline |
Returns true if
has the same rules as this time zone.
The base implementation returns true if both time zones have the same raw offset.
|
abstract |
Returns true if
is in a daylight savings time period for this time zone.
|
inlinestatic |
Overrides the default time zone for the current process only.
Warning: avoid using this method to use a custom time zone in your process. This value may be cleared or overwritten at any time, which can cause unexpected behavior. Instead, manually supply a custom time zone as needed.
timeZone | a custom time zone, or null |
|
inline |
Sets the ID of this
.
|
abstract |
Sets the offset in milliseconds from UTC of this time zone's standard time.
|
abstract |
Returns true if this time zone has a future transition to or from daylight savings time.
Warning: this returns false for time zones like
that have previously used DST but do not currently. A hypothetical country that has never observed daylight savings before but plans to start next year would return true.
Warning: this returns true for time zones that use DST, even when it is not active.
Use inDaylightTime to find out whether daylight savings is in effect at a specific time.
Most applications should not use this method.
|
static |
The long display name style, such as
. Requests for this style may yield GMT offsets like
.
|
static |
The short display name style, such as
. Requests for this style may yield GMT offsets like
.