Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个日期和时间值,我使用 POSIXct 将其存储在变量中。当我使用 as.Date 时,日期不同 - 为什么?
x<-as.POSIXct("2012-02-25 19:00:00") as.Date(x) [1] "2012-02-**26**"
为什么天数加 1?
通过简单地使用x<-as.POSIXct("2012-02-25 19:00:00"),您将设置时区 ,tz为您当前的系统时区 EST。
x<-as.POSIXct("2012-02-25 19:00:00")
tz
但是,当您在as.Date未声明时区的情况下使用时,它将默认为 GMT。格林威治标准时间比美国东部标准时间早 5 小时,因此 25/02/2012 19:00 是 00:00 26/02/2012。
as.Date