Import date-time at a specified timezone, disregard Daylight Savings Time

前端 未结 2 1359
鱼传尺愫
鱼传尺愫 2020-12-16 19:17

I have time series data obtained from a data logger that was set to one time zone without daylight savings (NZST or UTC+12:00), and the data spans a few years. Data loggers

相关标签:
2条回答
  • 2020-12-16 19:34

    You can use tz="Etc/GMT+12":

    as.POSIXct(ts_str, format="%d/%m/%Y %H:%M", tz="Etc/GMT+12")
    [1] "2008-09-28 01:00:00 GMT+12" "2008-09-28 02:00:00 GMT+12"
    [3] "2008-09-28 03:00:00 GMT+12"
    

    For a full list of available timezones use,

    dir(file.path(R.home("share"),"zoneinfo"), recursive=TRUE)
    

    There are a couple of of .tab files in there which aren't timezones but hold some information, but my regex-fu isn't good enough to be able to exclude them with the pattern argument to dir.

    0 讨论(0)
  • 2020-12-16 19:49

    If just add 12*60*60 to that UTC derived vector, you will have local "standard" time.

    0 讨论(0)
提交回复
热议问题