with_timezone | R Documentation |
Change the time zone, and restore it afterwards.
with_timezone(tz, code)
local_timezone(tz, .local_envir = parent.frame())
tz |
|
code |
|
.local_envir |
The environment to apply the change to. |
with_timezone()
runs the code with the specified time zone and
resets it afterwards.
local_timezone()
changes the time zone for the caller
execution environment.
[any]
The results of the evaluation of the code
argument.
withr
for examples
Sys.timezone()
.
Sys.time()
with_timezone("Europe/Paris", print(Sys.time()))
with_timezone("America/Los_Angeles", print(Sys.time()))
fun1 <- function() {
local_timezone("CET")
print(Sys.time())
}
fun2 <- function() {
local_timezone("America/Los_Angeles")
print(Sys.time())
}
Sys.time()
fun1()
fun2()
Sys.time()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.