A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/util/SimpleTimeZone.html below:

SimpleTimeZone (Java SE 15 & JDK 15)

All Implemented Interfaces:
Serializable, Cloneable
public class SimpleTimeZone
extends 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

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 field value, such as Calendar.MARCH. The day-of-week value is represented by a Calendar DAY_OF_WEEK value, such as 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

mode

s to specify the time:

WALL_TIME

,

STANDARD_TIME

and

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

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, GregorianCalendar, TimeZone, Serialized Form

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4