How do you convert dates/times from one time zone to another in R?

后端 未结 4 2195
南旧
南旧 2020-11-27 13:27

If I have a date like this in London time: \"2009-06-03 19:30\", how can I convert it to the equivalent time in the US West Coast?

4条回答
  •  猫巷女王i
    2020-11-27 13:46

    Package lubridate holds two functions to convert timezones. According to the help pages:


    force_tz returns a date-time that has the same clock time as x in the new time zone.

    force_tz(time, tzone = "America/Los_Angeles")
    


    with_tz changes the time zone in which an instant is displayed. The clock time displayed for the instant changes, but the moment of time described remains the same.

    with_tz(time, tzone = "America/Los_Angeles")
    

提交回复
热议问题