Learn R Programming

splusTimeDate (version 2.5.0-137)

timeZoneR: Constructor Function for timeZoneR Class

Description

Construct a timeZoneR object.

Usage

timeZoneR(offset=0, yearfrom=integer(0), yearto=integer(0), hasdaylight=logical(0), dsextra=integer(0), monthstart=integer(0), codestart=integer(0), daystart=integer(0), xdaystart=integer(0), timestart=integer(0), monthend=integer(0), codeend=integer(0), dayend=integer(0), xdayend=integer(0), timeend=integer(0), rules)

Arguments

Note: The arguments other than offset and rules define the components of the rules for when to go on daylight savings. Each is a vector with one component for each rule.
offset
the offset from GMT (in seconds) when not on daylight savings time.
yearfrom
the starting years for rules, or -1 to start at the beginning of time.
yearto
the ending years for rules, or -1 to end at the end of time.
hasdaylight
specifies whether daylight savings time is used in each year range.
dsextra
the offsets (in seconds) to add to the regular offset when daylight time is in effect.
monthstart
the months (1-12) in which daylight savings time starts (can be after monthend for the southern hemisphere).
codestart
the codes telling how to interpret daystart and xdaystart to calculate the days 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.
daystart
see codestart.
xdaystart
see codestart.
timestart
the seconds after midnight local standard time to start daylight savings time, on the day specified by codestart and other arguments.
monthend
the months (1-12) in which daylight savings time ends (can be before monthstart for the southern hemisphere).
codeend
the codes specifying interpreting 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.
dayend
see codeend.
xdayend
see codeend.
timeend
the seconds after midnight local standard time to end daylight savings time, on the day specified by codeend and other arguments.
rules
a data frame of rules encoding when to go on daylight savings time. (Overrides all other arguments except offset, if it is not missing, and must contain columns corresponding to those arguments in that order, or be completely empty. Note that the columns should all be integer. See timeZoneR class documentation for more information.)

Value

returns a timeZoneR object with the given name, or the default time zone if no arguments are supplied.

Details

The timeZoneR class provides to users a way to define time zones. To use the defined time zones in timeDate objects, they must also be added to the time zone list. (See timeZoneList for more information.)

See Also

timeZoneList, timeZoneC, timeZone class.

Examples

Run this code
timeZoneR() 
timeZoneR(offset=3*3600) 
# time zone with daylight time that changed to daylight time on the  
# last Sunday in April and last Sunday in September through 1989,  
# and then on the 1st Sunday in May and October thereafter.
# Each time change occurs at 2AM local standard time.
timeZoneR( offset = 3600, 
		  yearfrom=c( -1, 1990), yearto=c( 1989, -1 ),  
		  hasdaylight=c( TRUE, TRUE ), dsextra=c( 3600, 3600 ),  
		  monthstart=c( 4, 5 ), codestart=c( 2, 3 ),  
		  daystart=c( 0, 0 ), xdaystart=c(0,1), 
		  timestart=c( 2*3600, 2*3600 ),  
		  monthend=c( 9, 10 ), codeend=c( 2, 3 ),  
		  dayend=c( 0, 0 ), xdayend=c(0,1), 
		  timeend=c(2*3600, 2*3600)) 

Run the code above in your browser using DataLab