出于某种原因,我无法通过as.POSIXlt
调整时区。调整R中的数据时区
time <- "Wed Jun 22 01:53:56 +0000 2016"
t <- strptime(time, format = '%a %b %d %H:%M:%S %z %Y')
t
[1] "2016-06-21 21:53:56"
无法更改时区
as.POSIXlt(t, "EST")
[1] "2016-06-21 21:53:56"
as.POSIXlt(t, "Australia/Darwin")
[1] "2016-06-21 21:53:56"
可以变更Sys.time()
as.POSIXlt(Sys.time(), "EST")
[1] "2016-09-26 01:47:22 EST"
as.POSIXlt(Sys.time(), "Australia/Darwin")
[1] "2016-09-26 16:19:48 ACST"
的时区如何解决呢?
我想在运行前两个posixlt命令在时间的矢量上,你实际上正在改变矢量的时区,但不是时间。所以现在认为't'在达尔文时间是21:53而不是EST。 –
试试'format(t,tz ='Australia/Darwin',usetz = TRUE)' –