from_datetimeoffset | R Documentation |
We register S3 methods to convert datetimeoffset()
objects to
other R datetime objects:
## S3 method for class 'datetimeoffset'
as.Date(x, ...)
## S3 method for class 'datetimeoffset'
as_date(x, ...)
## S3 method for class 'datetimeoffset'
as.POSIXct(x, tz = mode_tz(x), ..., fill = "")
## S3 method for class 'datetimeoffset'
as_date_time(x, zone = mode_tz(x), ..., fill = NA_character_)
## S3 method for class 'datetimeoffset'
as.POSIXlt(x, tz = mode_tz(x), ..., fill = "")
## S3 method for class 'datetimeoffset'
as_year_month_day(x, ...)
## S3 method for class 'datetimeoffset'
as_year_month_weekday(x, ...)
## S3 method for class 'datetimeoffset'
as_iso_year_week_day(x, ...)
## S3 method for class 'datetimeoffset'
as_year_quarter_day(x, ..., start = NULL)
## S3 method for class 'datetimeoffset'
as_year_day(x, ...)
## S3 method for class 'datetimeoffset'
as_naive_time(x, ...)
## S3 method for class 'datetimeoffset'
as_sys_time(
x,
...,
ambiguous = "error",
nonexistent = "error",
fill = NA_character_
)
## S3 method for class 'datetimeoffset'
as_zoned_time(
x,
zone = mode_tz(x),
...,
ambiguous = "error",
nonexistent = "error",
fill = NA_character_
)
## S3 method for class 'datetimeoffset'
as_weekday(x, ...)
x |
A |
... |
Ignored |
tz , zone |
What time zone to assume |
fill |
If timezone and UTC offset info is missing what
timezone to assume. See |
start |
The month to start the fiscal year in.
See |
ambiguous |
What to do when the "clock time" in the new time zone is ambiguous.
See |
nonexistent |
What to do when the "clock time" in the new time zone doesn't exist.
See |
We register S3 methods for the following:
as.Date()
and clock::as_date()
returns the "local" date as a base::Date()
object
as.POSIXct()
and clock::as_date_time()
returns the "local" datetime as a base::POSIXct()
object
as.POSIXlt()
returns the "local" datetime as a base::POSIXlt()
object
nanotime::as.nanotime()
returns the "global" datetime as a nanotime::nanotime()
object
parttime::as.parttime()
returns the "local" datetime as a parttime::parttime()
object
clock::as_year_month_day()
returns a clock::year_month_day()
calendar
clock::as_year_month_weekday()
returns a clock::year_month_weekday()
calendar
clock::as_iso_year_week_day()
returns a clock::iso_year_week_day()
calendar
clock::as_year_quarter_day()
returns a clock::year_quarter_day()
calendar
clock::as_year_day()
returns a clock::year_day()
calendar
clock::as_naive_time()
returns a "clock" naive-time
clock::as_sys_time()
returns a "clock" sys-time
clock::as_zoned_time()
returns a "clock" zoned-time
clock::as_weekday()
returns a clock::weekday()
object
A datetime object vector
# {base}
today <- as_datetimeoffset(Sys.Date())
now <- as_datetimeoffset(Sys.time())
as.Date(today)
as.Date(now)
as.POSIXct(now)
as.POSIXlt(now)
# {clock}
clock::as_date(today)
clock::as_date_time(now)
clock::as_year_month_day(now)
clock::as_year_month_weekday(now)
clock::as_iso_year_week_day(now)
clock::as_year_quarter_day(now)
clock::as_year_day(now)
clock::as_naive_time(now)
clock::as_sys_time(now)
clock::as_zoned_time(now)
clock::as_weekday(now)
if (requireNamespace("nanotime")) {
nanotime::as.nanotime(now)
}
if (requireNamespace("parttime")) {
parttime::as.parttime(now)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.