How to change Sys.time () timezone
2 answers
Depending on what you want to do exactly, there are several options:
s <- Sys.time()
s
#[1] "2015-06-18 11:21:22 EST"
Switching from local time to GMT, without application:
as.POSIXct(format(s),tz="GMT")
#[1] "2015-06-18 11:21:22 GMT"
Go to GMT, adjust the time difference between local time and GMT.
`attr<-`(s,"tzone","GMT")
#[1] "2015-06-18 01:21:22 GMT"
which is equivalent to an assignment operation:
attr(s,"tzone") <- "GMT"
+3
source to share