How do I convert correctly timezones

前端 未结 3 653
忘了有多久
忘了有多久 2021-02-11 02:17

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:53

    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"
    

提交回复
热议问题