Top Description Fields Constructors Methods
com.ibm.icu.util

public Class VTimeZone

extends BasicTimeZone
Class Inheritance
Imports
java.io.BufferedWriter, .IOException, .Reader, .Writer, java.util.ArrayList, .Date, .LinkedList, .List, .MissingResourceException, .StringTokenizer, com.ibm.icu.impl.Grego

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.

ICU Status
Stable since ICU 3.8.

Field Summary

Modifier and TypeField and Description
private static final String
private static final String
private static final int
private static final long
private static final String
private static final int
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String[]
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static String
private static final int
private transient volatile boolean
private Date
private static final long
private static final long
private static final int[]
private static final String
private String
private static final String
private static final long
private BasicTimeZone
private static final int
private String
private static final int
private List<String>
Inherited from com.ibm.icu.util.BasicTimeZone:
FORMER_LATTER_MASKLOCAL_DSTLOCAL_FORMERLOCAL_LATTERLOCAL_STDSTD_DST_MASK

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
private static void
appendUNTIL(Writer writer, String until)

private static void
beginRRULE(Writer writer, int month)

private static void
beginZoneProps(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, long startTime)

public Object
clone()

Overrides com.ibm.icu.util.TimeZone.clone.

Overrides clone.
public TimeZone
public static VTimeZone

Returns:

A VTimeZone initialized by the time zone ID, or null when the ID is unknown.
create
(String
The time zone ID, such as America/New_York
tzid
)

Create a VTimeZone instance by the time zone ID.

public static VTimeZone

Returns:

A VTimeZone initialized by the VTIMEZONE data or null if failed to load the rule from the VTIMEZONE data.
create
(Reader
The Reader for VTIMEZONE data input stream
reader
)

Create a VTimeZone instance by RFC2445 VTIMEZONE data.

private static TimeZoneRule
createRuleByRDATE(String tzname, int rawOffset, int dstSavings, long start, List<String> dates, int fromOffset)

private static TimeZoneRule
createRuleByRRULE(String tzname, int rawOffset, int dstSavings, long start, List<String> dates, int fromOffset)

private static void
endZoneProps(Writer writer, boolean isDst)

public TimeZone
private static String
getDateTimeString(long time)

private static String
getDefaultTZName(String tzid, boolean isDST)

public Date

Returns:

The Date represents the RFC2445 LAST-MODIFIED date.
getLastModified
()

Gets the RFC2445 LAST-MODIFIED property value.

public TimeZoneTransition
getNextTransition(long
The base time.
base
,
boolean
Whether the base time is inclusive or not.
inclusive
)

Implements abstract com.ibm.icu.util.BasicTimeZone.getNextTransition.

ICU

public int
getOffset(int
the era of the given date.
era
,
int
the year in the given date.
year
,
int
the month in the given date. Month is 0-based. e.g., 0 for January.
month
,
int
the day-in-month of the given date.
day
,
int
the day-of-week of the given date.
dayOfWeek
,
int
the millis in day in standard local time.
milliseconds
)

Implements abstract com.ibm.icu.util.TimeZone.getOffset.

Gets the time zone offset, for current date, modified in case of daylight savings.
public void
getOffset(long
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.
date
,
boolean
if true, date is local wall time; otherwise it is in GMT time.
local
,
int[]
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.
offsets
)

Overrides com.ibm.icu.util.TimeZone.getOffset.

Returns the time zone raw and GMT offset for the given moment in time.
public void
getOffsetFromLocal(long date, BasicTimeZone.LocalOption nonExistingTimeOpt, BasicTimeZone.LocalOption duplicatedTimeOpt, int[] offsets)

Overrides com.ibm.icu.util.BasicTimeZone.getOffsetFromLocal.

ICU

public TimeZoneTransition
getPreviousTransition(long
The base time.
base
,
boolean
Whether the base time is inclusive or not.
inclusive
)

Implements abstract com.ibm.icu.util.BasicTimeZone.getPreviousTransition.

ICU

public int
getRawOffset()

Implements abstract com.ibm.icu.util.TimeZone.getRawOffset.

Gets unmodified offset, NOT modified in case of daylight savings.
public TimeZoneRule[]
public TimeZoneRule[]
getTimeZoneRules(long
The start time (inclusive).
start
)

Overrides com.ibm.icu.util.BasicTimeZone.getTimeZoneRules.

ICU

public String

Returns:

The RFC2445 TZURL property value
getTZURL
()

Gets the RFC2445 TZURL property value.

private static String
public boolean
hasEquivalentTransitions(TimeZone
The instance of TimeZone
other
,
long
The start time of the evaluated time range (inclusive)
start
,
long
The end time of the evaluated time range (inclusive)
end
)

Overrides com.ibm.icu.util.BasicTimeZone.hasEquivalentTransitions.

ICU

public boolean
hasSameRules(TimeZone
the TimeZone object to be compared with
other
)

Overrides com.ibm.icu.util.TimeZone.hasSameRules.

Returns true if this zone has the same rule and offset as another zone.
public boolean
inDaylightTime(Date
the given Date.
date
)

Implements abstract com.ibm.icu.util.TimeZone.inDaylightTime.

Queries if the given date is in daylight savings time in this time zone.
private static boolean
isEquivalentDateRule(int month, int weekInMonth, int dayOfWeek, DateTimeRule dtrule)

public boolean
isFrozen()

Overrides com.ibm.icu.util.TimeZone.isFrozen.

Implements com.ibm.icu.util.Freezable.isFrozen.

Determines whether the object has been frozen or not.
private boolean
load(Reader reader)

private static String
millisToOffset(int millis)

private static String
numToString(int num, int width)

public boolean
observesDaylightTime()

Overrides com.ibm.icu.util.TimeZone.observesDaylightTime.

Queries if this time zone is in daylight saving time or will observe daylight saving time at any future time.
private static int
private boolean
private static long
parseDateTimeString(String str, int offset)

private static int[]
parseRRULE(String rrule, long[] until)

public void
setLastModified(Date
The Date object represents the date for RFC2445 LAST-MODIFIED property value.
date
)

Sets the date used for RFC2445 LAST-MODIFIED property value.

public void
setRawOffset(int
the given base time zone offset to GMT.
offsetMillis
)

Implements abstract com.ibm.icu.util.TimeZone.setRawOffset.

Sets the base time zone offset to GMT.
public void
setTZURL(String
The TZURL property value.
url
)

Sets the RFC2445 TZURL property value.

private static DateTimeRule
toWallTimeRule(DateTimeRule rule, int rawOffset, int dstSavings)

public boolean
useDaylightTime()

Implements abstract com.ibm.icu.util.TimeZone.useDaylightTime.

Queries if this time zone uses daylight savings time.
public void
write(Writer
A Writer used for the output
writer
)

Writes RFC2445 VTIMEZONE data for this time zone

public void
write(Writer
The Writer used for the output
writer
,
long
The start time
start
)

Writes RFC2445 VTIMEZONE data applicable for dates after the specified start time.

private static void
writeFinalRule(Writer writer, boolean isDst, AnnualTimeZoneRule rule, int fromRawOffset, int fromDSTSavings, long startTime)

private static void
private void
public void
writeSimple(Writer
The Writer used for the output
writer
,
long
The date
time
)

Writes RFC2445 VTIMEZONE data applicable near the specified date.

private void
writeZone(Writer w, BasicTimeZone basictz, String[] customProperties)

private static void
writeZonePropsByDOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, long startTime, long untilTime)

private static void
writeZonePropsByDOW(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int weekInMonth, int dayOfWeek, long startTime, long untilTime)

private static void
writeZonePropsByDOW_GEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime)

private static void
writeZonePropsByDOW_GEQ_DOM_sub(Writer writer, int month, int dayOfMonth, int dayOfWeek, int numDays, long untilTime, int fromOffset)

private static void
writeZonePropsByDOW_LEQ_DOM(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, int month, int dayOfMonth, int dayOfWeek, long startTime, long untilTime)

private static void
writeZonePropsByTime(Writer writer, boolean isDst, String tzname, int fromOffset, int toOffset, long time, boolean withRDATE)

Inherited from com.ibm.icu.util.BasicTimeZone:
getLocalOptionValuegetSimpleTimeZoneRulesNearhasEquivalentTransitions