timeDate {splusTimeDate} | R Documentation |
Constructor Function for timeDate Objects
Description
Constructs a timeDate
object from a character vector, a vector of julian days, or a vector of milliseconds, or constructs an empty timeDate
object.
Usage
timeDate(charvec, in.format,
format, zone,
julian, ms, in.origin=c(month=1, day=1, year=1960))
Arguments
charvec |
a character vector to read the times from. |
in.format |
the input format string for |
format |
the output format stored in the result. The default is |
zone |
the time zone stored in the result. The default value is |
julian |
an integer vector of the number of days since |
ms |
an integer vector of milliseconds since midnight. |
in.origin |
the origin for the |
Details
One of charvec
, julian
, or ms
must be supplied,
unless the function is called with no arguments.
If
charvec
is supplied, thentimeDate
reads the times from thecharvec
character strings using the format string fromin.format
. This conversion uses the time zone supplied inzone
.If
charvec
is not supplied, thentimeDate
usesjulian
and/orms
to construct the time vector. These are copied directly to the internals of the time object without considering the time zone (that is, they must be given in GMT, or the user must calltimeZoneConvert
afterwards).
Leap seconds do not cause NA
values, but it can cause times of day to be off by a second on the days that contain them.
For information about possible values for the in.format
and format
arguments, see the documentation for the timeDate
class (class.timeDate
).
Value
returns a timeDate
object derived from the inputs.
See Also
timeCalendar
,
timeDate
,
format.timeDate
,
timeZoneConvert
.
Examples
timeDate()
timeDate(c("1/1/97", "2/1/97", "mar 1, 1997"))
timeDate(c("1 PM", "2 PM", "3 AM"), in.format = "%H %p",
format = "%I %p")
timeDate(julian = 36, ms = 876393,
in.origin = c(month=1,day=1,year=1998))
## Get today's date in yyyymmdd format
timeDate(date(), in.format="%w %m %d %H:%M:%S %Y",
format="%Y%02m%02d")