Learn R Programming

splusTimeDate (version 2.5.0-137)

timeCalendar: Constructor Function for timeDate Objects

Description

Constructs a time object corresponding to calendar dates and/or times of day.

Usage

timeCalendar( m=NULL, d=NULL, y=NULL, h=NULL, min=NULL, s=NULL, ms=NULL, format, zone )

Arguments

m
calendar months (1-12). The default is 1.
d
calendar days (1-31). The default is 1.
y
calendar years (e.g. 1997). The default is 1960.
h
hours of the days (0-23). The default is 0.
min
minutes of the days (0-59). The default is 0.
s
seconds of the days (0-59). The default is 0.
ms
milliseconds of the days (0-999). The default is 0.
format
the output format string to apply to the returned object. The default is from timeDateOptions("time.out.format").
zone
the time zone of the input date and time. Also stored in the result. The default is from timeDateOptions("time.zone").

Value

returns a timeDate object corresponding to the input.

Details

If none of m, d, y, h, min, s, and ms are supplied, this function returns a time vector of length zero. If more than one is supplied, they must all have compatible lengths. Shorter inputs are used cyclically to comprise the maximum length, but they must be even multiples.

The arguments represent the date and time of day in the given time zone. Missing arguments are supplied to give a time of midnight, January 1, 1960.

Leap seconds do not cause NA values, but can cause times of day to be off by a second in the days containing them.

See Also

timeDate, timeDate class, mdy, format.timeDate.

Examples

Run this code
timeCalendar(m = c(3, 4, 5), d = c(12, 15, 7), y = c(1998, 1997, 2004), 
     format = "%b. %d, %Y") 
timeCalendar(h = c(9, 14), min = c(15, 23), format = "%I:%02M %p") 

Run the code above in your browser using DataLab