Learn R Programming

splusTimeDate (version 2.5.8)

timeZone-class: Time Zone Classes

Description

The timeZone classes represent time zones.

Arguments

'timezone' slots

timeZone is a virtual class and has no slots.

'timezonec' slots

name

(character) the name of a built-in time zone.

'timezones' slots

offset

(integer) the offset from GMT (in seconds) when not on daylight savings time.

rules

(data.frame) rules encoding when to go on daylight savings time (see below).

Built-in zones

The splusTimeDate package contains built-in time zones for the 24 standard time zones around the world. We also include daylight savings time in various areas, and standard time for Central Australia, which is 1/2 hour off Eastern Australia. Currently, the correct daylight savings areas provided are:

  • US (1967 and beyond).

  • Canada (1974 and beyond).

  • New Zealand (1976 and beyond).

  • Australia (1973 and beyond).

  • Great Britain (1972 and beyond).

  • European Union (1977 and beyond).

  • Hong Kong (1970 and beyond).

Also, we provide a special time zone for Singapore, which was 7:30 ahead of GMT until May of 1982, when it changed over to 8:00.

The official names of the time zones, in order around the world, are shown below along with their offset from Universal Coordinated Time (UTC, also known as GMT).

st/newzealand

Standard time for New Zealand, UTC East 12 hours.

newzealand

Standard/summer time for New Zealand.

st/caroline

Standard time for Caroline, UTC East 11 hours.

st/eaustralia

Standard time for Eastern Australia, UTC East 10 hours.

aust/nsw

Standard/summer time for New South Wales, Australia.

aust/tasmania

Standard/summer time for Tasmania, Australia.

aust/victoria

Standard/summer time for Victoria, Australia.

st/caustralia

Standard time for Central Australia, UTC East 9:30 hours.

aust/south

Standard/summer time for South Australia.

st/japan

Standard time for Japan, UTC East 9 hours.

st/china

Standard time for China, UTC East 8 hours.

aust/western

Standard/summer time for Western Australia.

hongkong

Standard/summer time for Hong Kong.

singapore

Standard time for Singapore, reflecting changed zones in 1982.

st/saigon

Standard time for Saigon, UTC East 7 hours.

st/kazakh

Standard time for Kazakh area, UTC East 6 hours.

st/pakistan

Standard time for Pakistan, UTC East 5 hours.

st/caspian

Standard time for Caspian Sea area, UTC East 4 hours.

st/moscow

Standard time for Moscow, UCT East 3 hours.

st/eeurope

Standard time in Eastern European zone, UTC East 2 hours.

europe/east

Standard/summer time for EU members, Eastern zone.

st/ceurope

Standard time in Central European zone, UTC East 1 hour.

europe/central

Standard/summer time for EU members, Central zone.

utc

UTC (also known as GMT).

britain

Standard/summer time for Great Britain,

europe/west

Standard/summer time for EU members, Western zone,

st/azores

Standard time for Azores, UTC West 1 hour.

st/oscar

Standard time for Oscar, UTC West 2 hours.

st/wgreenland

Standard time for Western Greenland, UTC West 3 hours.

can/newfoundland

Standard/daylight time for Newfoundland, Canada.

st/atlantic

Standard time for Atlantic time zone, UTC West 4 hours.

can/atlantic

Standard/daylight Canadian Atlantic time.

st/eastern

Standard time for Eastern time zone, UTC West 5 hours.

us/eastern

Standard/daylight US Eastern time.

can/eastern

Standard/daylight Canadian Eastern time.

st/central

Standard time for Central time zone, UTC West 6 hours.

us/central

Standard/daylight US Central time.

can/central

Standard/daylight Canadian Central time.

st/mountain

Standard time for Mountain time zone, UTC West 7 hours.

us/mountain

Standard/daylight US Mountain time.

can/mountain

Standard/daylight Canadian Mountain time .

st/pacific

Standard time for Pacific time zone, UTC West 8 hours.

us/pacific

Standard/daylight US Pacific time.

can/pacific

Standard/daylight Canadian Pacific time .

st/alaska

Standard time for Alaska/Yukon time, UTC West 9 hours.

us/alaska

Standard/daylight US Alaska time.

can/yukon

Standard/daylight Canadian Yukon time.

st/hawaii

Standard time for Hawaii/Alleutian, UTC West 10 hours.

us/hawaii

Standard/daylight US Hawaii/Alleutian time.

st/samoa

Standard time for Samoa, UTC West 11 hours.

Using zones

You can use the time zones listed in Built-In Zones for various operations on timeDate objects, including reading times from character data, writing times as character data, and converting between time zones. However, normally the names listed in the table are not used directly, because users want to use the names commonly used in their areas, such as CST for Central Standard Time in the US, Canada, or Australia. The correspondence between "convenient" and "official" names is set up using the timeZoneList function.

Defining zones

Besides using the time zones listed in Built-In Zones, users can also define their own time zones through use of the timeZoneR class. This class allows specification of a time zone with an offset from GMT, in seconds, in the offset slot, and a data frame containing rules for when and how to go on daylight savings time in the rules slot. (If there is no daylight savings time in this time zone, the data frame should be empty or have 0 rows.)

Each row in the rules data frame encodes a range of years' daylight savings rules; they must be in order to work properly. The rules are encoded in the following columns of the data frame (which must be in order, and all of class integer):

yearfromstarting year for rules, or -1 to start at the beginning of time.
yeartoending year for rules, or -1 to end at the end of time.
hasdaylightindicates whether daylight savings time is used in this year range. Note that this is an integer value, 1 or 0, for true or false.
dsextraoffset (in seconds) to add to the regular offset when daylight time is in effect.
monthstartmonth (1-12) in which daylight savings time starts (may be before monthend for southern hemisphere).
codestartcode telling how to interpret daystart and xdaystart to calculate the day within the month for starting daylight savings time.
1 = start on the daystart (1-31) day of the month.
2 = start on the last daystart (0-Sunday through 6-Saturday) weekday in the month.
3 = start on the first daystart weekday (0-Sunday through 6-Saturday) on or after the xdaystart (1-31) day of the month.
4 = start on the last daystart weekday (0-Sunday through 6-Saturday) on or before the xdaystart (1-31) day of the month.
daystartsee codestart.
xdaystartsee codestart.
timestartseconds after midnight local standard time to start daylight savings time, on the day specified by codestart, and so on.
monthendmonth (1-12) in which daylight savings time ends (may be after monthstart for southern hemisphere).
codeendcode telling how to interpret dayend and xdayend to calculate the day within the month for ending daylight savings time.
1 = end on the dayend (1-31) day of the month.
2 = end on the last dayend (0-Sunday through 6-Saturday) weekday in the month.
3 = end on the first dayend weekday (0-Sunday through 6-Saturday) on or after the xdayend (1-31) day of the month.
4 = end on the last dayend weekday (0-Sunday through 6-Saturday) on or before the xdayend (1-31) day of the month.
dayendsee codeend.
xdayendsee codeend. For examples, see the timeZoneR function. To use user-defined time zones, you must put them in the time zone list (see timeZoneList function).
timeendseconds after midnight local standard time to end daylight savings time, on the day specified by codeend, etc.

Details

The timeZone class is a virtual class for time zones. All time zones classes have an is relationship with timeZone.

The timeZoneC class is a placeholder for a built-in time zone, and it has only one slot, which is the official name of the zone; it extends timeZone.

The timeZoneR class is for user-defined time zones, and also extends timeZone.

References

Daylight savings boundaries and other time zone information are from the Time Zone Database (often called tz or zoneinfo). See: https://www.iana.org/time-zones.

See Also

timeZoneC function, timeZoneR function, timeZoneList function.