setters | R Documentation |
Setter methods for datetimeoffset()
objects.
## S3 method for class 'datetimeoffset'
set_year(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_month(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_day(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_hour(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_minute(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_second(x, value, ..., na_set = FALSE)
## S3 method for class 'datetimeoffset'
set_nanosecond(x, value, ..., na_set = FALSE, digits = NULL)
set_subsecond_digits(x, value, ...)
## S3 method for class 'datetimeoffset'
set_subsecond_digits(x, value, ..., na_set = FALSE)
set_hour_offset(x, value, ...)
## S3 method for class 'datetimeoffset'
set_hour_offset(x, value, ..., na_set = FALSE)
set_minute_offset(x, value, ...)
## S3 method for class 'datetimeoffset'
set_minute_offset(x, value, ..., na_set = FALSE)
set_tz(x, value, ...)
## S3 method for class 'datetimeoffset'
set_tz(x, value, ..., na_set = FALSE)
## S3 method for class 'clock_zoned_time'
set_tz(x, value, ..., nonexistent = "error", ambiguous = "error")
## Default S3 method:
set_tz(x, value, ...)
x |
A datetime object. |
value |
The replacement value. For |
... |
Currently ignored. |
na_set |
If |
digits |
If |
nonexistent |
What to do when the "clock time" in the new time zone doesn't exist.
See |
ambiguous |
What to do when the "clock time" in the new time zone is ambiguous.
See |
We implement datetimeoffset()
support for the following S3 methods from clock
:
set_year()
set_month()
set_day()
set_hour()
set_minute()
set_second()
set_nanosecond()
We also implemented new S3 setter methods:
set_hour_offset()
set_minute_offset()
set_tz()
(changes system time but not clock time)
We also implement datetimeoffset()
support for the following S4 methods from lubridate
:
year<-()
month<-()
day<-()
hour<-()
minute<-()
second<-()
date<-()
A datetime object.
library("clock")
dt <- NA_datetimeoffset_
dt <- set_year(dt, 1918L, na_set = TRUE)
dt <- set_month(dt, 11L)
dt <- set_day(dt, 11L)
dt <- set_hour(dt, 11L)
dt <- set_minute(dt, 11L)
dt <- set_second(dt, 11L)
dt <- set_nanosecond(dt, 123456789L)
dt <- set_subsecond_digits(dt, 4L)
dt <- set_hour_offset(dt, 0L)
dt <- set_minute_offset(dt, 0L)
dt <- set_tz(dt, "Europe/Paris")
format(dt)
if (require("lubridate")) {
dt <- datetimeoffset(0L)
year(dt) <- 1918L
month(dt) <- 11L
day(dt) <- 11L
hour(dt) <- 11L
minute(dt) <- 11L
second(dt) <- 11L
if (packageVersion("lubridate") > '1.8.0' &&
"Europe/Paris" %in% OlsonNames()) {
tz(dt) <- "Europe/Paris"
}
format(dt)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.