7

我在一个对象中有一堆 1 分钟返回,xts索引POSIXct为 GMT,时区为 GMT。回报在纽约证券交易所,所以我想转换为东部时区,但我想妥善处理夏令时。这样做的最佳方法是什么?我对 EST 时区和 EDT 时区有点困惑。我希望我的时间在冬季和夏季正确转换为纽约时间。

4

1 回答 1

6

使用indexTZ<-America/New_York时区

> 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). 
于 2012-08-11T20:13:08.763 回答