time zones in POSIXct and xts, converting from GMT in R

一笑奈何 提交于 2019-12-04 06:30:57

Use indexTZ<- and the America/New_York timezone

> tail(SPY)
                    SPY.Bid.Price SPY.Ask.Price SPY.Trade.Price SPY.Mid.Price SPY.Volume
2012-08-09 19:54:00        140.47        140.48          140.48       140.475       2372
2012-08-09 19:55:00        140.46        140.47          140.46       140.465       5836
2012-08-09 19:56:00        140.47        140.48          140.48       140.475       2538
2012-08-09 19:57:00        140.47        140.48          140.47       140.475       2209
2012-08-09 19:58:00        140.48        140.49          140.49       140.485       4943
2012-08-09 19:59:00        140.58        140.59          140.58       140.585      16780
> indexTZ(SPY) <- "America/New_York"
> tail(SPY)
                    SPY.Bid.Price SPY.Ask.Price SPY.Trade.Price SPY.Mid.Price SPY.Volume
2012-08-09 15:54:00        140.47        140.48          140.48       140.475       2372
2012-08-09 15:55:00        140.46        140.47          140.46       140.465       5836
2012-08-09 15:56:00        140.47        140.48          140.48       140.475       2538
2012-08-09 15:57:00        140.47        140.48          140.47       140.475       2209
2012-08-09 15:58:00        140.48        140.49          140.49       140.485       4943
2012-08-09 15:59:00        140.58        140.59          140.58       140.585      16780
Warning message:
timezone of object (America/New_York) is different than current timezone (GMT). 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!