How do I convert correctly timezones

前端 未结 3 2135
渐次进展
渐次进展 2021-02-11 02:10

I am using the fasttime package for its fastPOSIXct function that can read character datetimes very efficiently. My problem is that it can only read character datet

3条回答
  •  自闭症患者
    2021-02-11 02:38

    Could you not just add the appropriate number of seconds to correct the offset from GMT?

    # Original problem
    fastPOSIXct("2010-03-15 12:37:17.223",tz="America/Montreal")
    # [1] "2010-03-15 08:37:17 EDT"
    
    # Add 4 hours worth of seconds to the data. This should be very quick.
    fastPOSIXct("2010-03-15 12:37:17.223",tz="America/Montreal") + 14400
    # [1] "2010-03-15 12:37:17 EDT"
    

提交回复
热议问题