java::util::SimpleTimeZone Class Reference

Inheritance diagram for java::util::SimpleTimeZone:

Inheritance graph
java::util::TimeZonejava::lang::Object
[legend]
Collaboration diagram for java::util::SimpleTimeZone:

Collaboration graph
java::util::TimeZonejava::lang::Objectjava::lang::Stringjava::lang::Interfacejava::lang::ObjectRefjava::util::DSTRulejava::lang::Comparable
[legend]

List of all members.


Detailed Description

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.

This class does not handle historical changes.

Use a negative value for dayOfWeekInMonth to indicate that SimpleTimeZone should count from the end of the month backwards. For example, Daylight Savings Time ends at the last (dayOfWeekInMonth = -1) Sunday in October, at 2 AM in standard time.

See also:
Calendar

GregorianCalendar

TimeZone

Version:
1.38 01/19/00
Author:
David Goldsmith, Mark Davis, Chen-Lieh Huang, Alan Liu

Public Member Functions

 SimpleTimeZone (jint rawOffset, const String &ID)
 Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID.
 SimpleTimeZone (jint rawOffset, const String &ID, DSTRule startRule, DSTRule endRule, jint dstSavings=millisPerHour)
 Construct a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, time to start and end the daylight time.
virtual void setStartYear (jint year)
 Sets the daylight savings starting year.
virtual void setStartRule (const DSTRule &_startRule)
virtual void setEndRule (const DSTRule &_endRule)
virtual jint getOffset (jint era, jint year, jint month, jint day, jint dayOfWeek, jint millis, jint monthLength, jint prevMonthLength) const
 Gets offset, for current date, modified in case of daylight savings.
virtual jint getRawOffset () const
 Overrides TimeZone Gets the GMT offset for this time zone.
virtual void setRawOffset (jint offsetMillis)
 Overrides TimeZone Sets the base time zone offset to GMT.
virtual void setDSTSavings (jint millisSavedDuringDST)
 Sets the amount of time in ms that the clock is advanced during DST.
virtual jint getDSTSavings () const
 Returns the amount of time in ms that the clock is advanced during DST.
virtual jboolean useDaylightTime () const
 Overrides TimeZone Queries if this time zone uses Daylight Savings Time.
virtual jint hashCode () const
 Override hashCode.
virtual jboolean equals (const Object &obj) const
 Compares the equality of two SimpleTimeZone objects.
virtual jboolean hasSameRules (const TimeZone &other) const
 Return true if this zone has the same rules and offset as another zone.
 SimpleTimeZone ()

Constructor & Destructor Documentation

java::util::SimpleTimeZone::SimpleTimeZone ( jint  rawOffset,
const String ID 
)

Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID.

Timezone IDs can be obtained from TimeZone.getAvailableIDs. Normally you should use TimeZone.getDefault to construct a TimeZone.

Parameters:
rawOffset The given base time zone offset to GMT.
ID The time zone ID which is obtained from TimeZone.getAvailableIDs.

java::util::SimpleTimeZone::SimpleTimeZone ( jint  rawOffset,
const String ID,
DSTRule  startRule,
DSTRule  endRule,
jint  dstSavings = millisPerHour 
)

Construct a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, time to start and end the daylight time.

Timezone IDs can be obtained from TimeZone.getAvailableIDs. Normally you should use TimeZone.getDefault to create a TimeZone. For a time zone that does not use daylight saving time, do not use this constructor; instead you should use SimpleTimeZone(rawOffset, ID).

By default, this constructor specifies day-of-week-in-month rules. That is, if the startDay is 1, and the startDayOfWeek is SUNDAY, then this indicates the first Sunday in the startMonth. A startDay of -1 likewise indicates the last Sunday. However, by using negative or zero values for certain parameters, other types of rules can be specified.

Day of month. To specify an exact day of the month, such as March 1, set startDayOfWeek to zero.

Day of week after day of month. To specify the first day of the week occurring on or after an exact day of the month, make the day of the week negative. For example, if startDay is 5 and startDayOfWeek is -MONDAY, this indicates the first Monday on or after the 5th day of the startMonth.

Day of week before day of month. To specify the last day of the week occurring on or before an exact day of the month, make the day of the week and the day of the month negative. For example, if startDay is -21 and startDayOfWeek is -WEDNESDAY, this indicates the last Wednesday on or before the 21st of the startMonth.

The above examples refer to the startMonth, startDay, and startDayOfWeek; the same applies for the endMonth, endDay, and endDayOfWeek.

Parameters:
rawOffset The given base time zone offset to GMT.
ID The time zone ID which is obtained from TimeZone.getAvailableIDs.
endMonth The daylight savings ending month. Month is 0-based. eg, 0 for January.
endDay The daylight savings ending day-of-week-in-month. Please see the member description for an example.
endDayOfWeek The daylight savings ending day-of-week. Please see the member description for an example.
endTime The daylight savings ending time in local wall time, which is daylight time in this case. Please see the member description for an example.
dstSavings The amount of time in ms saved during DST.
Exceptions:
IllegalArgumentException the month, day, dayOfWeek, or time parameters are out of range for the start or end rule
Since:
DK1.1

java::util::SimpleTimeZone::SimpleTimeZone (  ) 


Member Function Documentation

virtual void java::util::SimpleTimeZone::setStartYear ( jint  year  )  [virtual]

Sets the daylight savings starting year.

Parameters:
year The daylight savings starting year.

virtual void java::util::SimpleTimeZone::setStartRule ( const DSTRule _startRule  )  [virtual]

virtual void java::util::SimpleTimeZone::setEndRule ( const DSTRule _endRule  )  [virtual]

virtual jint java::util::SimpleTimeZone::getOffset ( jint  era,
jint  year,
jint  month,
jint  day,
jint  dayOfWeek,
jint  millis,
jint  monthLength,
jint  prevMonthLength 
) const [virtual]

Gets offset, for current date, modified in case of daylight savings.

This is the offset to add to UTC to get local time. Gets the time zone offset, for current date, modified in case of daylight savings. This is the offset to add *to* UTC to get local time. Assume that the start and end month are distinct.

Parameters:
era 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.
millis The milliseconds in day in standard local time.
monthLength The length of the given month in days.
prevMonthLength The length of the previous month in days.
Returns:
The offset to add *to* GMT to get local time.
Exceptions:
IllegalArgumentException the era, month, day, dayOfWeek, millis, or monthLength parameters are out of range

Implements java::util::TimeZone.

virtual jint java::util::SimpleTimeZone::getRawOffset (  )  const [virtual]

Overrides TimeZone Gets the GMT offset for this time zone.

Implements java::util::TimeZone.

virtual void java::util::SimpleTimeZone::setRawOffset ( jint  offsetMillis  )  [virtual]

Overrides TimeZone Sets the base time zone offset to GMT.

This is the offset to add *to* UTC to get local time. Please see TimeZone.setRawOffset for descriptions on the parameter.

Implements java::util::TimeZone.

virtual void java::util::SimpleTimeZone::setDSTSavings ( jint  millisSavedDuringDST  )  [virtual]

Sets the amount of time in ms that the clock is advanced during DST.

Parameters:
millisSavedDuringDST the number of milliseconds the time is advanced with respect to standard time when the daylight savings rules are in effect. A positive number, typically one hour (3600000).
Since:
1.2

virtual jint java::util::SimpleTimeZone::getDSTSavings (  )  const [virtual]

Returns the amount of time in ms that the clock is advanced during DST.

Returns:
the number of milliseconds the time is advanced with respect to standard time when the daylight savings rules are in effect. A positive number, typically one hour (3600000).
Since:
1.2

virtual jboolean java::util::SimpleTimeZone::useDaylightTime (  )  const [virtual]

Overrides TimeZone Queries if this time zone uses Daylight Savings Time.

Implements java::util::TimeZone.

virtual jint java::util::SimpleTimeZone::hashCode (  )  const [virtual]

Override hashCode.

Generates the hash code for the SimpleDateFormat object

Reimplemented from java::lang::Object.

virtual jboolean java::util::SimpleTimeZone::equals ( const Object obj  )  const [virtual]

Compares the equality of two SimpleTimeZone objects.

Parameters:
obj The SimpleTimeZone object to be compared with.
Returns:
True if the given obj is the same as this SimpleTimeZone object; false otherwise.

Reimplemented from java::lang::Object.

virtual jboolean java::util::SimpleTimeZone::hasSameRules ( const TimeZone other  )  const [virtual]

Return true if this zone has the same rules and offset as another zone.

Parameters:
other the TimeZone object to be compared with
Returns:
true if the given zone has the same rules and offset as this one
Since:
1.2

Reimplemented from java::util::TimeZone.


The documentation for this class was generated from the following file:
Generated on Fri May 16 11:56:51 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3