java.util
Class SimpleTimeZone

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.util.TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone 
      extended by java.util.SimpleTimeZone
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable , Cloneable sample code for java.lang.Cloneable definition code for java.lang.Cloneable

public class SimpleTimeZone
extends TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar. The class holds an offset from GMT, called raw offset, and start and end rules for a daylight saving time schedule. Since it only holds single values for each, it cannot handle historical changes in the offset from GMT and the daylight saving schedule, except that the setStartYear sample code for java.util.SimpleTimeZone.setStartYear(int) definition code for java.util.SimpleTimeZone.setStartYear(int) method can specify the year when the daylight saving time schedule starts in effect.

To construct a SimpleTimeZone with a daylight saving time schedule, the schedule can be described with a set of rules, start-rule and end-rule. A day when daylight saving time starts or ends is specified by a combination of month, day-of-month, and day-of-week values. The month value is represented by a Calendar MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value, such as Calendar.MARCH sample code for java.util.Calendar.MARCH definition code for java.util.Calendar.MARCH . The day-of-week value is represented by a Calendar DAY_OF_WEEK sample code for java.util.Calendar.DAY_OF_WEEK definition code for java.util.Calendar.DAY_OF_WEEK value, such as SUNDAY sample code for java.util.Calendar.SUNDAY definition code for java.util.Calendar.SUNDAY . The meanings of value combinations are as follows.

The time of the day at which daylight saving time starts or ends is specified by a millisecond value within the day. There are three kinds of modes to specify the time: WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME , STANDARD_TIME sample code for java.util.SimpleTimeZone.STANDARD_TIME definition code for java.util.SimpleTimeZone.STANDARD_TIME and UTC_TIME sample code for java.util.SimpleTimeZone.UTC_TIME definition code for java.util.SimpleTimeZone.UTC_TIME . For example, if daylight saving time ends at 2:00 am in the wall clock time, it can be specified by 7200000 milliseconds in the WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME mode. In this case, the wall clock time for an end-rule means the same thing as the daylight time.

The following are examples of parameters for constructing time zone objects.


      // Base GMT offset: -8:00
      // DST starts:      at 2:00am in standard time
      //                  on the first Sunday in April
      // DST ends:        at 2:00am in daylight time
      //                  on the last Sunday in October
      // Save:            1 hour
      SimpleTimeZone(-28800000,
                     "America/Los_Angeles",
                     Calendar.APRIL, 1, -Calendar.SUNDAY,
                     7200000,
                     Calendar.OCTOBER, -1, Calendar.SUNDAY,
                     7200000,
                     3600000)

      // Base GMT offset: +1:00
      // DST starts:      at 1:00am in UTC time
      //                  on the last Sunday in March
      // DST ends:        at 1:00am in UTC time
      //                  on the last Sunday in October
      // Save:            1 hour
      SimpleTimeZone(3600000,
                     "Europe/Paris",
                     Calendar.MARCH, -1, Calendar.SUNDAY,
                     3600000, SimpleTimeZone.UTC_TIME,
                     Calendar.OCTOBER, -1, Calendar.SUNDAY,
                     3600000, SimpleTimeZone.UTC_TIME,
                     3600000)
 
These parameter rules are also applicable to the set rule methods, such as setStartRule.

Since:
1.1
See Also:
Calendar sample code for java.util.Calendar definition code for java.util.Calendar , GregorianCalendar sample code for java.util.GregorianCalendar definition code for java.util.GregorianCalendar , TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone , Serialized Form

Field Summary
static int STANDARD_TIME sample code for java.util.SimpleTimeZone.STANDARD_TIME definition code for java.util.SimpleTimeZone.STANDARD_TIME
          Constant for a mode of start or end time specified as standard time.
static int UTC_TIME sample code for java.util.SimpleTimeZone.UTC_TIME definition code for java.util.SimpleTimeZone.UTC_TIME
          Constant for a mode of start or end time specified as UTC.
static int WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME
          Constant for a mode of start or end time specified as wall clock time.
 
Fields inherited from class java.util.TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone
LONG sample code for java.util.TimeZone.LONG definition code for java.util.TimeZone.LONG , SHORT sample code for java.util.TimeZone.SHORT definition code for java.util.TimeZone.SHORT
 
Constructor Summary
SimpleTimeZone sample code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String) definition code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String) (int rawOffset, String sample code for java.lang.String definition code for java.lang.String  ID)
          Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID with no daylight saving time schedule.
SimpleTimeZone sample code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int) (int rawOffset, String sample code for java.lang.String definition code for java.lang.String  ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int endMonth, int endDay, int endDayOfWeek, int endTime)
          Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.
SimpleTimeZone sample code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int) (int rawOffset, String sample code for java.lang.String definition code for java.lang.String  ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int endMonth, int endDay, int endDayOfWeek, int endTime, int dstSavings)
          Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.
SimpleTimeZone sample code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int, int, int) (int rawOffset, String sample code for java.lang.String definition code for java.lang.String  ID, int startMonth, int startDay, int startDayOfWeek, int startTime, int startTimeMode, int endMonth, int endDay, int endDayOfWeek, int endTime, int endTimeMode, int dstSavings)
          Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time.
 
Method Summary
 Object sample code for java.lang.Object definition code for java.lang.Object clone sample code for java.util.SimpleTimeZone.clone() definition code for java.util.SimpleTimeZone.clone() ()
          Returns a clone of this SimpleTimeZone instance.
 boolean equals sample code for java.util.SimpleTimeZone.equals(java.lang.Object) definition code for java.util.SimpleTimeZone.equals(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  obj)
          Compares the equality of two SimpleTimeZone objects.
 int getDSTSavings sample code for java.util.SimpleTimeZone.getDSTSavings() definition code for java.util.SimpleTimeZone.getDSTSavings() ()
          Returns the amount of time in milliseconds that the clock is advanced during daylight saving time.
 int getOffset sample code for java.util.SimpleTimeZone.getOffset(int, int, int, int, int, int) definition code for java.util.SimpleTimeZone.getOffset(int, int, int, int, int, int) (int era, int year, int month, int day, int dayOfWeek, int millis)
          Returns the difference in milliseconds between local time and UTC, taking into account both the raw offset and the effect of daylight saving, for the specified date and time.
 int getOffset sample code for java.util.SimpleTimeZone.getOffset(long) definition code for java.util.SimpleTimeZone.getOffset(long) (long date)
          Returns the offset of this time zone from UTC at the given time.
 int getRawOffset sample code for java.util.SimpleTimeZone.getRawOffset() definition code for java.util.SimpleTimeZone.getRawOffset() ()
          Gets the GMT offset for this time zone.
 int hashCode sample code for java.util.SimpleTimeZone.hashCode() definition code for java.util.SimpleTimeZone.hashCode() ()
          Generates the hash code for the SimpleDateFormat object.
 boolean hasSameRules sample code for java.util.SimpleTimeZone.hasSameRules(java.util.TimeZone) definition code for java.util.SimpleTimeZone.hasSameRules(java.util.TimeZone) (TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone  other)
          Returns true if this zone has the same rules and offset as another zone.
 boolean inDaylightTime sample code for java.util.SimpleTimeZone.inDaylightTime(java.util.Date) definition code for java.util.SimpleTimeZone.inDaylightTime(java.util.Date) (Date sample code for java.util.Date definition code for java.util.Date  date)
          Queries if the given date is in daylight saving time.
 void setDSTSavings sample code for java.util.SimpleTimeZone.setDSTSavings(int) definition code for java.util.SimpleTimeZone.setDSTSavings(int) (int millisSavedDuringDST)
          Sets the amount of time in milliseconds that the clock is advanced during daylight saving time.
 void setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int) (int endMonth, int endDay, int endTime)
          Sets the daylight saving time end rule to a fixed date within a month.
 void setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int, int) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int, int) (int endMonth, int endDay, int endDayOfWeek, int endTime)
          Sets the daylight saving time end rule.
 void setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int, int, boolean) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int, int, boolean) (int endMonth, int endDay, int endDayOfWeek, int endTime, boolean after)
          Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.
 void setRawOffset sample code for java.util.SimpleTimeZone.setRawOffset(int) definition code for java.util.SimpleTimeZone.setRawOffset(int) (int offsetMillis)
          Sets the base time zone offset to GMT.
 void setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int) (int startMonth, int startDay, int startTime)
          Sets the daylight saving time start rule to a fixed date within a month.
 void setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int, int) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int, int) (int startMonth, int startDay, int startDayOfWeek, int startTime)
          Sets the daylight saving time start rule.
 void setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int, int, boolean) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int, int, boolean) (int startMonth, int startDay, int startDayOfWeek, int startTime, boolean after)
          Sets the daylight saving time start rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.
 void setStartYear sample code for java.util.SimpleTimeZone.setStartYear(int) definition code for java.util.SimpleTimeZone.setStartYear(int) (int year)
          Sets the daylight saving time starting year.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.util.SimpleTimeZone.toString() definition code for java.util.SimpleTimeZone.toString() ()
          Returns a string representation of this time zone.
 boolean useDaylightTime sample code for java.util.SimpleTimeZone.useDaylightTime() definition code for java.util.SimpleTimeZone.useDaylightTime() ()
          Queries if this time zone uses daylight saving time.
 
Methods inherited from class java.util.TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone
getAvailableIDs sample code for java.util.TimeZone.getAvailableIDs() definition code for java.util.TimeZone.getAvailableIDs() , getAvailableIDs sample code for java.util.TimeZone.getAvailableIDs(int) definition code for java.util.TimeZone.getAvailableIDs(int) , getDefault sample code for java.util.TimeZone.getDefault() definition code for java.util.TimeZone.getDefault() , getDisplayName sample code for java.util.TimeZone.getDisplayName() definition code for java.util.TimeZone.getDisplayName() , getDisplayName sample code for java.util.TimeZone.getDisplayName(boolean, int) definition code for java.util.TimeZone.getDisplayName(boolean, int) , getDisplayName sample code for java.util.TimeZone.getDisplayName(boolean, int, java.util.Locale) definition code for java.util.TimeZone.getDisplayName(boolean, int, java.util.Locale) , getDisplayName sample code for java.util.TimeZone.getDisplayName(java.util.Locale) definition code for java.util.TimeZone.getDisplayName(java.util.Locale) , getID sample code for java.util.TimeZone.getID() definition code for java.util.TimeZone.getID() , getTimeZone sample code for java.util.TimeZone.getTimeZone(java.lang.String) definition code for java.util.TimeZone.getTimeZone(java.lang.String) , setDefault sample code for java.util.TimeZone.setDefault(java.util.TimeZone) definition code for java.util.TimeZone.setDefault(java.util.TimeZone) , setID sample code for java.util.TimeZone.setID(java.lang.String) definition code for java.util.TimeZone.setID(java.lang.String)
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME

public static final int WALL_TIME
Constant for a mode of start or end time specified as wall clock time. Wall clock time is standard time for the onset rule, and daylight time for the end rule.

Since:
1.4
See Also:
Constant Field Values

STANDARD_TIME sample code for java.util.SimpleTimeZone.STANDARD_TIME

public static final int STANDARD_TIME
Constant for a mode of start or end time specified as standard time.

Since:
1.4
See Also:
Constant Field Values

UTC_TIME sample code for java.util.SimpleTimeZone.UTC_TIME

public static final int UTC_TIME
Constant for a mode of start or end time specified as UTC. European Union rules are specified as UTC time, for example.

Since:
1.4
See Also:
Constant Field Values
Constructor Detail

SimpleTimeZone sample code for java.util.SimpleTimeZone(int, java.lang.String) definition code for java.util.SimpleTimeZone(int, java.lang.String)

public SimpleTimeZone(int rawOffset,
                      String sample code for java.lang.String definition code for java.lang.String  ID)
Constructs a SimpleTimeZone with the given base time zone offset from GMT and time zone ID with no daylight saving time schedule.

Parameters:
rawOffset - The base time zone offset in milliseconds to GMT.
ID - The time zone name that is given to this instance.

SimpleTimeZone sample code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int)

public SimpleTimeZone(int rawOffset,
                      String sample code for java.lang.String definition code for java.lang.String  ID,
                      int startMonth,
                      int startDay,
                      int startDayOfWeek,
                      int startTime,
                      int endMonth,
                      int endDay,
                      int endDayOfWeek,
                      int endTime)
Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time. Both startTime and endTime are specified to be represented in the wall clock time. The amount of daylight saving is assumed to be 3600000 milliseconds (i.e., one hour). This constructor is equivalent to:

     SimpleTimeZone(rawOffset,
                    ID,
                    startMonth,
                    startDay,
                    startDayOfWeek,
                    startTime,
                    SimpleTimeZone.WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME ,
                    endMonth,
                    endDay,
                    endDayOfWeek,
                    endTime,
                    SimpleTimeZone.WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME ,
                    3600000)
 

Parameters:
rawOffset - The given base time zone offset from GMT.
ID - The time zone ID which is given to this object.
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts. See the class description for the special cases of this parameter.
startDayOfWeek - The daylight saving time starting day-of-week. See the class description for the special cases of this parameter.
startTime - The daylight saving time starting time in local wall clock time (in milliseconds within the day), which is local standard time in this case.
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends. See the class description for the special cases of this parameter.
endDayOfWeek - The daylight saving time ending day-of-week. See the class description for the special cases of this parameter.
endTime - The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the month, day, dayOfWeek, or time parameters are out of range for the start or end rule

SimpleTimeZone sample code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int)

public SimpleTimeZone(int rawOffset,
                      String sample code for java.lang.String definition code for java.lang.String  ID,
                      int startMonth,
                      int startDay,
                      int startDayOfWeek,
                      int startTime,
                      int endMonth,
                      int endDay,
                      int endDayOfWeek,
                      int endTime,
                      int dstSavings)
Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time. Both startTime and endTime are assumed to be represented in the wall clock time. This constructor is equivalent to:

     SimpleTimeZone(rawOffset,
                    ID,
                    startMonth,
                    startDay,
                    startDayOfWeek,
                    startTime,
                    SimpleTimeZone.WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME ,
                    endMonth,
                    endDay,
                    endDayOfWeek,
                    endTime,
                    SimpleTimeZone.WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME ,
                    dstSavings)
 

Parameters:
rawOffset - The given base time zone offset from GMT.
ID - The time zone ID which is given to this object.
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts. See the class description for the special cases of this parameter.
startDayOfWeek - The daylight saving time starting day-of-week. See the class description for the special cases of this parameter.
startTime - The daylight saving time starting time in local wall clock time, which is local standard time in this case.
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends. See the class description for the special cases of this parameter.
endDayOfWeek - The daylight saving time ending day-of-week. See the class description for the special cases of this parameter.
endTime - The daylight saving ending time in local wall clock time, which is local daylight time in this case.
dstSavings - The amount of time in milliseconds saved during daylight saving time.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the month, day, dayOfWeek, or time parameters are out of range for the start or end rule
Since:
1.2

SimpleTimeZone sample code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int, int, int) definition code for java.util.SimpleTimeZone(int, java.lang.String, int, int, int, int, int, int, int, int, int, int, int)

public SimpleTimeZone(int rawOffset,
                      String sample code for java.lang.String definition code for java.lang.String  ID,
                      int startMonth,
                      int startDay,
                      int startDayOfWeek,
                      int startTime,
                      int startTimeMode,
                      int endMonth,
                      int endDay,
                      int endDayOfWeek,
                      int endTime,
                      int endTimeMode,
                      int dstSavings)
Constructs a SimpleTimeZone with the given base time zone offset from GMT, time zone ID, and rules for starting and ending the daylight time. This constructor takes the full set of the start and end rules parameters, including modes of startTime and endTime. The mode specifies either wall time sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME or standard time sample code for java.util.SimpleTimeZone.STANDARD_TIME definition code for java.util.SimpleTimeZone.STANDARD_TIME or UTC time sample code for java.util.SimpleTimeZone.UTC_TIME definition code for java.util.SimpleTimeZone.UTC_TIME .

Parameters:
rawOffset - The given base time zone offset from GMT.
ID - The time zone ID which is given to this object.
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts. See the class description for the special cases of this parameter.
startDayOfWeek - The daylight saving time starting day-of-week. See the class description for the special cases of this parameter.
startTime - The daylight saving time starting time in the time mode specified by startTimeMode.
startTimeMode - The mode of the start time specified by startTime.
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends. See the class description for the special cases of this parameter.
endDayOfWeek - The daylight saving time ending day-of-week. See the class description for the special cases of this parameter.
endTime - The daylight saving ending time in time time mode specified by endTimeMode.
endTimeMode - The mode of the end time specified by endTime
dstSavings - The amount of time in milliseconds saved during daylight saving time.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the month, day, dayOfWeek, time more, or time parameters are out of range for the start or end rule, or if a time mode value is invalid.
Since:
1.4
See Also:
WALL_TIME sample code for java.util.SimpleTimeZone.WALL_TIME definition code for java.util.SimpleTimeZone.WALL_TIME , STANDARD_TIME sample code for java.util.SimpleTimeZone.STANDARD_TIME definition code for java.util.SimpleTimeZone.STANDARD_TIME , UTC_TIME sample code for java.util.SimpleTimeZone.UTC_TIME definition code for java.util.SimpleTimeZone.UTC_TIME
Method Detail

setStartYear sample code for java.util.SimpleTimeZone.setStartYear(int) definition code for java.util.SimpleTimeZone.setStartYear(int)

public void setStartYear(int year)
Sets the daylight saving time starting year.

Parameters:
year - The daylight saving starting year.

setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int, int) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int, int)

public void setStartRule(int startMonth,
                         int startDay,
                         int startDayOfWeek,
                         int startTime)
Sets the daylight saving time start rule. For example, if daylight saving time starts on the first Sunday in April at 2 am in local wall clock time, you can set the start rule by calling:
setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2*60*60*1000);

Parameters:
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts. See the class description for the special cases of this parameter.
startDayOfWeek - The daylight saving time starting day-of-week. See the class description for the special cases of this parameter.
startTime - The daylight saving time starting time in local wall clock time, which is local standard time in this case.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the startMonth, startDay, startDayOfWeek, or startTime parameters are out of range

setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int)

public void setStartRule(int startMonth,
                         int startDay,
                         int startTime)
Sets the daylight saving time start rule to a fixed date within a month. This method is equivalent to:
setStartRule(startMonth, startDay, 0, startTime)

Parameters:
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts.
startTime - The daylight saving time starting time in local wall clock time, which is local standard time in this case. See the class description for the special cases of this parameter.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the startMonth, startDayOfMonth, or startTime parameters are out of range
Since:
1.2

setStartRule sample code for java.util.SimpleTimeZone.setStartRule(int, int, int, int, boolean) definition code for java.util.SimpleTimeZone.setStartRule(int, int, int, int, boolean)

public void setStartRule(int startMonth,
                         int startDay,
                         int startDayOfWeek,
                         int startTime,
                         boolean after)
Sets the daylight saving time start rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.

Parameters:
startMonth - The daylight saving time starting month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 0 for January).
startDay - The day of the month on which the daylight saving time starts.
startDayOfWeek - The daylight saving time starting day-of-week.
startTime - The daylight saving time starting time in local wall clock time, which is local standard time in this case.
after - If true, this rule selects the first dayOfWeek on or after dayOfMonth. If false, this rule selects the last dayOfWeek on or before dayOfMonth.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the startMonth, startDay, startDayOfWeek, or startTime parameters are out of range
Since:
1.2

setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int, int) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int, int)

public void setEndRule(int endMonth,
                       int endDay,
                       int endDayOfWeek,
                       int endTime)
Sets the daylight saving time end rule. For example, if daylight saving time ends on the last Sunday in October at 2 am in wall clock time, you can set the end rule by calling: setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2*60*60*1000);

Parameters:
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends. See the class description for the special cases of this parameter.
endDayOfWeek - The daylight saving time ending day-of-week. See the class description for the special cases of this parameter.
endTime - The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - if the endMonth, endDay, endDayOfWeek, or endTime parameters are out of range

setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int)

public void setEndRule(int endMonth,
                       int endDay,
                       int endTime)
Sets the daylight saving time end rule to a fixed date within a month. This method is equivalent to:
setEndRule(endMonth, endDay, 0, endTime)

Parameters:
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends.
endTime - The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - the endMonth, endDay, or endTime parameters are out of range
Since:
1.2

setEndRule sample code for java.util.SimpleTimeZone.setEndRule(int, int, int, int, boolean) definition code for java.util.SimpleTimeZone.setEndRule(int, int, int, int, boolean)

public void setEndRule(int endMonth,
                       int endDay,
                       int endDayOfWeek,
                       int endTime,
                       boolean after)
Sets the daylight saving time end rule to a weekday before or after the given date within a month, e.g., the first Monday on or after the 8th.

Parameters:
endMonth - The daylight saving time ending month. Month is a MONTH sample code for java.util.Calendar.MONTH definition code for java.util.Calendar.MONTH field value (0-based. e.g., 9 for October).
endDay - The day of the month on which the daylight saving time ends.
endDayOfWeek - The daylight saving time ending day-of-week.
endTime - The daylight saving ending time in local wall clock time, (in milliseconds within the day) which is local daylight time in this case.
after - If true, this rule selects the first endDayOfWeek on or after endDay. If false, this rule selects the last endDayOfWeek on or before endDay of the month.
Throws:
IllegalArgumentException sample code for java.lang.IllegalArgumentException definition code for java.lang.IllegalArgumentException - the endMonth, endDay, endDayOfWeek, or endTime parameters are out of range
Since:
1.2

getOffset sample code for java.util.SimpleTimeZone.getOffset(long) definition code for java.util.SimpleTimeZone.getOffset(long)

public int getOffset(long date)
Returns the offset of this time zone from UTC at the given time. If daylight saving time is in effect at the given time, the offset value is adjusted with the amount of daylight saving.

Overrides:
getOffset sample code for java.util.TimeZone.getOffset(long) definition code for java.util.TimeZone.getOffset(long) in class TimeZone sample code for java.util.TimeZone definition code for java.util.TimeZone
Parameters:
date - the time at which the time zone offset is found
Returns:
the amount of time in milliseconds to add to UTC to get local time.
Since:
1.4
See Also:
Calendar.ZONE_OFFSET sample code for java.util.Calendar.ZONE_OFFSET