|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.ibm.icu.util.TimeZone
com.ibm.icu.util.BasicTimeZone
com.ibm.icu.util.VTimeZone
public class VTimeZone
VTimeZone is a class implementing RFC2445 VTIMEZONE. You can create a
VTimeZone instance from a time zone ID supported by TimeZone.
With the VTimeZone instance created from the ID, you can write out the rule
in RFC2445 VTIMEZONE format. Also, you can create a VTimeZone instance
from RFC2445 VTIMEZONE data stream, which allows you to calculate time
zone offset by the rules defined by the data.
Note: The consumer of this class reading or writing VTIMEZONE data is responsible to
decode or encode Non-ASCII text. Methods reading/writing VTIMEZONE data in this class
do nothing with MIME encoding.
| Field Summary |
|---|
| Fields inherited from class com.ibm.icu.util.BasicTimeZone |
|---|
FORMER_LATTER_MASK, LOCAL_DST, LOCAL_FORMER, LOCAL_LATTER, LOCAL_STD, STD_DST_MASK |
| Fields inherited from class com.ibm.icu.util.TimeZone |
|---|
LONG, SHORT, TIMEZONE_ICU, TIMEZONE_JDK |
| Method Summary | |
|---|---|
Object |
clone()
Overrides Cloneable |
static VTimeZone |
create(Reader reader)
Create a VTimeZone instance by RFC2445 VTIMEZONE data. |
static VTimeZone |
create(String tzid)
Create a VTimeZone instance by the time zone ID. |
Date |
getLastModified()
Gets the RFC2445 LAST-MODIFIED property value. |
TimeZoneTransition |
getNextTransition(long base,
boolean inclusive)
Gets the first time zone transition after the base time. |
int |
getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int milliseconds)
Gets the time zone offset, for current date, modified in case of daylight savings. |
void |
getOffset(long date,
boolean local,
int[] offsets)
Returns the time zone raw and GMT offset for the given moment in time. |
void |
getOffsetFromLocal(long date,
int nonExistingTimeOpt,
int duplicatedTimeOpt,
int[] offsets)
Deprecated. This API is ICU internal only. |
TimeZoneTransition |
getPreviousTransition(long base,
boolean inclusive)
Gets the last time zone transition before the base time. |
int |
getRawOffset()
Gets unmodified offset, NOT modified in case of daylight savings. |
TimeZoneRule[] |
getTimeZoneRules()
Gets the array of TimeZoneRule which represents the rule
of this time zone object. |
TimeZoneRule[] |
getTimeZoneRules(long start)
Gets the array of TimeZoneRule which represents the rule
of this time zone object since the specified start time. |
String |
getTZURL()
Gets the RFC2445 TZURL property value. |
boolean |
hasEquivalentTransitions(TimeZone other,
long start,
long end)
Checks if the time zone has equivalent transitions in the time range. |
boolean |
hasSameRules(TimeZone other)
Returns true if this zone has the same rule and offset as another zone. |
boolean |
inDaylightTime(Date date)
Queries if the given date is in daylight savings time in this time zone. |
void |
setLastModified(Date date)
Sets the date used for RFC2445 LAST-MODIFIED property value. |
void |
setRawOffset(int offsetMillis)
Sets the base time zone offset to GMT. |
void |
setTZURL(String url)
Sets the RFC2445 TZURL property value. |
boolean |
useDaylightTime()
Queries if this time zone uses daylight savings time. |
void |
write(Writer writer)
Writes RFC2445 VTIMEZONE data for this time zone |
void |
write(Writer writer,
long start)
Writes RFC2445 VTIMEZONE data applicable for dates after the specified start time. |
void |
writeSimple(Writer writer,
long time)
Writes RFC2445 VTIMEZONE data applicable near the specified date. |
| Methods inherited from class com.ibm.icu.util.BasicTimeZone |
|---|
getSimpleTimeZoneRulesNear, hasEquivalentTransitions |
| Methods inherited from class com.ibm.icu.util.TimeZone |
|---|
countEquivalentIDs, equals, getAvailableIDs, getAvailableIDs, getAvailableIDs, getCanonicalID, getCanonicalID, getDefault, getDefaultTimeZoneType, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDisplayName, getDSTSavings, getEquivalentID, getID, getOffset, getTimeZone, getTimeZone, getTZDataVersion, hashCode, setDefault, setDefaultTimeZoneType, setID |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static VTimeZone create(String tzid)
VTimeZone instance by the time zone ID.
tzid - The time zone ID, such as America/New_York
VTimeZone initialized by the time zone ID, or null
when the ID is unknown.public static VTimeZone create(Reader reader)
VTimeZone instance by RFC2445 VTIMEZONE data.
reader - The Reader for VTIMEZONE data input stream
VTimeZone initialized by the VTIMEZONE data or
null if failed to load the rule from the VTIMEZONE data.
public int getOffset(int era,
int year,
int month,
int day,
int dayOfWeek,
int milliseconds)
getOffset in class TimeZoneera - the era of the given date.year - the year in the given date.month - the month in the given date.
Month is 0-based. e.g., 0 for January.day - the day-in-month of the given date.dayOfWeek - the day-of-week of the given date.milliseconds - the millis in day in standard local time.
public void getOffset(long date,
boolean local,
int[] offsets)
getOffset in class TimeZonedate - moment in time for which to return offsets, in
units of milliseconds from January 1, 1970 0:00 GMT, either GMT
time or local wall time, depending on `local'.local - if true, `date' is local wall time; otherwise it
is in GMT time.offsets - output parameter to receive the raw offset, that
is, the offset not including DST adjustments, in offsets[0],
and the DST offset, that is, the offset to be added to
`rawOffset' to obtain the total offset between local and GMT
time, in offsets[1]. If DST is not in effect, the DST offset is
zero; otherwise it is a positive value, typically one hour.
public void getOffsetFromLocal(long date,
int nonExistingTimeOpt,
int duplicatedTimeOpt,
int[] offsets)
getOffsetFromLocal in class BasicTimeZonepublic int getRawOffset()
getRawOffset in class TimeZonepublic boolean inDaylightTime(Date date)
inDaylightTime in class TimeZonedate - the given Date.
public void setRawOffset(int offsetMillis)
setRawOffset in class TimeZoneoffsetMillis - the given base time zone offset to GMT.public boolean useDaylightTime()
useDaylightTime in class TimeZonepublic boolean hasSameRules(TimeZone other)
hasSameRules in class TimeZoneother - the TimeZone object to be compared with
public String getTZURL()
VTimeZone instance was created from
VTIMEZONE data, the value is set by the TZURL property value in the data. Otherwise,
the initial value is null.
public void setTZURL(String url)
url - The TZURL property value.public Date getLastModified()
VTimeZone instance was created
from VTIMEZONE data, the value is set by the LAST-MODIFIED property value in the data.
Otherwise, the initial value is null.
public void setLastModified(Date date)
date - The Date object represents the date for RFC2445 LAST-MODIFIED property value.
public void write(Writer writer)
throws IOException
writer - A Writer used for the output
IOException
public void write(Writer writer,
long start)
throws IOException
writer - The Writer used for the outputstart - The start time
IOException
public void writeSimple(Writer writer,
long time)
throws IOException
writer - The Writer used for the outputtime - The date
IOException
public TimeZoneTransition getNextTransition(long base,
boolean inclusive)
getNextTransition in class BasicTimeZonebase - The base time.inclusive - Whether the base time is inclusive or not.
Date holding the first time zone transition time
after the given base time, or null if no time zone transitions
are available after the base time.
public TimeZoneTransition getPreviousTransition(long base,
boolean inclusive)
getPreviousTransition in class BasicTimeZonebase - The base time.inclusive - Whether the base time is inclusive or not.
Date holding the last time zone transition time
before the given base time, or null if no time zone transitions
are available before the base time.
public boolean hasEquivalentTransitions(TimeZone other,
long start,
long end)
hasEquivalentTransitions in class BasicTimeZoneother - The instance of TimeZonestart - The start time of the evaluated time range (inclusive)end - The end time of the evaluated time range (inclusive)
BasicTimeZone, this method
returns false.public TimeZoneRule[] getTimeZoneRules()
TimeZoneRule which represents the rule
of this time zone object. The first element in the result array will
be the InitialTimeZoneRule instance for the initial rule.
The rest will be either AnnualTimeZoneRule or
TimeArrayTimeZoneRule instances representing transitions.
getTimeZoneRules in class BasicTimeZoneTimeZoneRule which represents this
time zone.public TimeZoneRule[] getTimeZoneRules(long start)
TimeZoneRule which represents the rule
of this time zone object since the specified start time. The first
element in the result array will be the InitialTimeZoneRule
instance for the initial rule. The rest will be either
AnnualTimeZoneRule or TimeArrayTimeZoneRule
instances representing transitions.
getTimeZoneRules in class BasicTimeZonestart - The start time (inclusive).
TimeZoneRule which represents this
time zone since the start time.public Object clone()
clone in class TimeZone
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||