Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid time zones in lubridate

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)
like image 655
emagar Avatar asked Apr 21 '15 22:04

emagar


People also ask

What is TZ R?

tz returns a date's time zone attribute. When used as a settor, it changes the time zone attribute. R does not come with a predefined list zone names, but relies on the user's OS to interpret time zone names. As a result, some names will be recognized on some computers but not others.

How do I change timezone in R?

According to the help pages: force_tz returns a date-time that has the same clock time as x in the new time zone. 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.


1 Answers

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.

like image 199
thelatemail Avatar answered Oct 14 '22 21:10

thelatemail