as.POSIXct分配不同的时区

时间:2015-07-26 16:29:35

标签: r timezone timestamp posixct

我正在导入一个结构为"%Y-%m-%d %H:%M:%S"的简单时间戳文件,即“2014-10-26 04:15:32”。样本数据集:

tz <- c("2014-10-26 00:27:14", "2014-10-26 00:42:14", "2014-10-26 00:57:14", "2014-10-26 01:12:14", "2014-10-26 01:27:14", "2014-10-26 01:42:14", "2014-10-26 01:57:14", "2014-10-26 02:00:32", "2014-10-26 02:12:14", "2014-10-26 02:15:32", "2014-10-26 02:27:14", "2014-10-26 02:30:32", "2014-10-26 02:42:14", "2014-10-26 02:45:32", "2014-10-26 02:57:14", "2014-10-26 03:00:32", "2014-10-26 03:15:32", "2014-10-26 03:30:32", "2014-10-26 03:45:32", "2014-10-26 04:00:32", "2014-10-26 04:15:32" )

之后,我用了 tz <- as.POSIXct(tz, format="%Y-%m-%d %H:%M:%S")没有分配任何时区。但是,当我显示tz时,输出如下:

[1] "2014-10-26 00:27:14 CEST" "2014-10-26 00:42:14 CEST" "2014-10-26 00:57:14 CEST" "2014-10-26 01:12:14 CEST" [5] "2014-10-26 01:27:14 CEST" "2014-10-26 01:42:14 CEST" "2014-10-26 01:57:14 CEST" "2014-10-26 02:00:32 CEST" [9] "2014-10-26 02:12:14 CEST" "2014-10-26 02:15:32 CEST" "2014-10-26 02:27:14 CEST" "2014-10-26 02:30:32 CET" [13] "2014-10-26 02:42:14 CET" "2014-10-26 02:45:32 CET" "2014-10-26 02:57:14 CET" "2014-10-26 03:00:32 CET" [17] "2014-10-26 03:15:32 CET" "2014-10-26 03:30:32 CET" "2014-10-26 03:45:32 CET" "2014-10-26 04:00:32 CET" [21] "2014-10-26 04:15:32 CET"

为什么R分配两个不同的时区 - CEST和CET? 我将本地设置更改为Sys.setlocale("LC_ALL","English"),我也使用了Sys.setenv(TZ='CET')但没有任何结果。我使用了Change timezone in a POSIXct objecthttp://blog.revolutionanalytics.com/2009/06/converting-time-zones.html描述的不同转换方式,但我仍然无法将时区更改为仅一个。提前谢谢!

0 个答案:

没有答案