Valid time zones in lubridate

emagar picture emagar · Apr 22, 2015 · Viewed 7.6k times · Source

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)

Answer

thelatemail picture thelatemail · Apr 22, 2015

Take a search through the OlsonNames() in the standard base R package, 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.