Valid time zones in lubridate

2020-03-08 08:38发布

问题:

A quick google search seems to get me nowhere. What are valid time zones in lubridate's tz option? In particular, am looking for Brasilia's time zone. Thanks!

library(lubridate)
dts <- c("6-3-1995 12:01:01","29-3-1995 23:01:01","29-3-1995 20:01:01")
dmy_hms(dts)               # locale's tz default
dmy_hms(dts, tz = "chile") # Chilean time (has one time zone only)

回答1:

Take a search through OlsonNames() which provides a list of all the valid timezones on the host system. e.g.:

grep("Brazil",OlsonNames(),value=TRUE)

...provides four possible results for Brazil.