|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.TimeZone
public abstract class TimeZone
TimeZone is an abstract class which represents a local time zone and its
daylight savings time rules. Subclasses support a particular calendar type,
such as the gregorian calendar.
Please note the type returned by factory methods, i.e. getDefault()
and getTimeZone(String), is implementation dependent, so that
it may introduce serialization incompatibility issue between different implementations.
Harmony returns instance of SimpleTimeZone so that the
bytes serialized by Harmony can be deserialized on other implementation successfully,
but the reverse compatibility cannot be guaranteed.
GregorianCalendar,
SimpleTimeZone,
Serialized Form| Field Summary | |
|---|---|
(package private) static TimeZone |
GMT
|
static int |
LONG
The LONG display name style. |
static int |
SHORT
The SHORT display name style. |
| Constructor Summary | |
|---|---|
TimeZone()
Constructs a new instance of this class. |
|
| Method Summary | |
|---|---|
Object |
clone()
Returns a new TimeZone with the same ID, rawOffset and daylight savings time rules as this TimeZone. |
static String[] |
getAvailableIDs()
Gets the available time zone IDs. |
static String[] |
getAvailableIDs(int offset)
Gets the available time zone IDs which match the specified offset from GMT. |
static TimeZone |
getDefault()
Gets the default time zone. |
String |
getDisplayName()
Gets the LONG name for this TimeZone for the default Locale in standard time. |
String |
getDisplayName(boolean daylightTime,
int style)
Gets the specified style of name (LONG or SHORT) for this TimeZone for the default Locale in either standard or daylight time as specified. |
String |
getDisplayName(boolean daylightTime,
int style,
Locale locale)
Gets the specified style of name (LONG or SHORT) for this TimeZone for the specified Locale in either standard or daylight time as specified. |
String |
getDisplayName(Locale locale)
Gets the LONG name for this TimeZone for the specified Locale in standard time. |
int |
getDSTSavings()
Gets the daylight savings offset in milliseconds for this TimeZone. |
String |
getID()
Gets the ID of this TimeZone. |
abstract int |
getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int time)
Gets the offset from GMT of this TimeZone for the specified date and time. |
int |
getOffset(long time)
Gets the offset from GMT of this TimeZone for the specified date. |
abstract int |
getRawOffset()
Gets the offset for standard time from GMT for this TimeZone. |
static TimeZone |
getTimeZone(String name)
Gets the time zone with the specified ID. |
boolean |
hasSameRules(TimeZone zone)
Returns if the specified TimeZone has the same raw offset as this TimeZone. |
abstract boolean |
inDaylightTime(Date time)
Returns if the specified Date is in the daylight savings time period for this TimeZone. |
static void |
setDefault(TimeZone timezone)
Sets the default time zone. |
void |
setID(String name)
Sets the ID of this TimeZone. |
abstract void |
setRawOffset(int offset)
Sets the offset for standard time from GMT for this TimeZone. |
abstract boolean |
useDaylightTime()
Returns if this TimeZone has a daylight savings time period. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int SHORT
public static final int LONG
static TimeZone GMT
| Constructor Detail |
|---|
public TimeZone()
| Method Detail |
|---|
public Object clone()
clone in class ObjectCloneablepublic static String[] getAvailableIDs()
public static String[] getAvailableIDs(int offset)
offset - the offset from GMT in milliseconds
public static TimeZone getDefault()
public final String getDisplayName()
public final String getDisplayName(Locale locale)
locale - the Locale
public final String getDisplayName(boolean daylightTime,
int style)
daylightTime - true for daylight time, false for standard timestyle - Either LONG or SHORT
public String getDisplayName(boolean daylightTime,
int style,
Locale locale)
daylightTime - true for daylight time, false for standard timestyle - Either LONG or SHORTlocale - the Locale
public String getID()
public int getDSTSavings()
This implementation returns 3600000 (1 hour), or 0 if the time zone does not observe daylight savings.
Subclasses may override to return daylight savings values other than 1 hour.
public int getOffset(long time)
time - the date in milliseconds since January 1, 1970 00:00:00 GMT
public abstract int getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int time)
era - the GregorianCalendar era, either GregorianCalendar.BC or
GregorianCalendar.ADyear - the yearmonth - the Calendar monthday - the day of the monthdayOfWeek - the Calendar day of the weektime - the time of day in milliseconds
public abstract int getRawOffset()
public static TimeZone getTimeZone(String name)
name - a time zone string ID
public boolean hasSameRules(TimeZone zone)
zone - a TimeZone
public abstract boolean inDaylightTime(Date time)
time - a Date
public static void setDefault(TimeZone timezone)
null, then
the next time getDefault() is called, the default time
zone with be determined. This behavior is slightly different than
the canonical description of this method, but it follows the spirit
of it.
timezone - a TimeZone objectpublic void setID(String name)
name - a string which is the time zone IDpublic abstract void setRawOffset(int offset)
offset - the offset from GMT in millisecondspublic abstract boolean useDaylightTime()
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||