Coercion from/to 'timeDate'
methods-as.Rd
Coerce and transform objects of class "timeDate"
.
Usage
## methods for base R functions
# S3 method for timeDate
as.character(x, ...)
# S3 method for timeDate
as.double(x,
units = c("auto", "secs", "mins", "hours", "days", "weeks"), ...)
# S3 method for timeDate
as.data.frame(x, ...)
# S3 method for timeDate
as.POSIXct(x, tz = "", ...)
# S3 method for timeDate
as.POSIXlt(x, tz = "", ...)
# S3 method for timeDate
as.Date(x, method = c("trunc", "round", "next"), ...)
## methods for as.timeDate
# S3 method for default
as.timeDate(x, zone = "", FinCenter = "")
# S3 method for POSIXt
as.timeDate(x, zone = "", FinCenter = "")
# S3 method for Date
as.timeDate(x, zone = "", FinCenter = "")
# S3 method for timeDate
as.timeDate(x, zone = x@FinCenter, FinCenter = "")
Arguments
- FinCenter
a character with the location of the financial center named as "continent/city".
- method
a character string denoting the method how to determine the dates.
- tz
inputs the time zone to POSIX objects, i.e. the time zone,
zone
, or financial center string,FinCenter
, as used by"timeDate"
objects.- units
a character string denoting the date/time units in which the results are desired.
- x
an object of class
"timeDate"
.- zone
the time zone or financial center where the data were recorded.
- ...
arguments passed to other methods.
Value
for as.timeDate.POSIXt
, an object of class "timeDate"
,
for as.timeDate.Date
, an object of class "timeDate"
Examples
## timeDate -
tC = timeCalendar()
## Convert 'timeDate' to a character strings:
as.character(tC)
#> [1] "2023-01-01" "2023-02-01" "2023-03-01" "2023-04-01" "2023-05-01"
#> [6] "2023-06-01" "2023-07-01" "2023-08-01" "2023-09-01" "2023-10-01"
#> [11] "2023-11-01" "2023-12-01"
## Coerce a 'Date' object into a 'timeDate' object:
as.timeDate(Sys.Date())
#> GMT
#> [1] [2023-12-15]