Java Reference
In-Depth Information
A time zone can be converted into a displayable form by using one of
the getdisplayName methods, similar to those of Locale . These methods
allow you to specify whether to use the default locale or a specified one,
and whether to use a short or long format. The string returned by the
display methods is controlled by a DateFormat object (which you'll see a
little later). These objects maintain their own tables of information on
how to format different time zones. On a given system they may not
maintain information for all the supported time zones, in which case the
generic identifier form is used, such as in the example on page 696 .
Each time zone has a raw offset from GMT , which can be either positive
or negative. You can get or set the raw offset by using getrawOffset or
set RawOffset , but you should rarely need to do this.
Daylight saving time supplements the raw offset with a seasonal time
shift. The value of this shift can be obtained from getdSTSavings the de-
fault implementation returns 3,600,000 (the number of milliseconds in
an hour). You can ask whether a time zone ever uses daylight saving
time during the year by invoking the method useDaylightTime , which re-
turns a boolean . The method inDaylightTime returns true if the Date argu-
ment you pass would fall inside daylight saving time in the zone.
You can obtain the exact offset for a time zone on a given date by spe-
cifying that date in milliseconds or by using calendar fields to specify the
year and month and so on.
public int getOffset(long date)
Returns the offset from GMT for the given time in this time
zone, taking any daylight saving time offset into account
public abstract int getOffset(int era, int year, int month, int day,
int dayOfWeek, int milliseconds)
Returns the offset from GMT for the given time in this time
zone, taking any daylight saving time offset into account. All
parameters are interpreted relative to the calendar for which
the particular time zone implementation is designed. The era
 
Search WWH ::




Custom Search