From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

system.timezone() and OlsonNames()

system.timezone() and OlsonNames()

- [Instructor] Take a careful look at this line of code. We're converting a date-time string to a POSIXlt date object. But what's important is the last part of the line where it says tz equals US/Pacific. That's a time zone. And this is helping this date string be recognized as occurring in a certain location. Let's take a little bit of time to figure out time zones with R. The first and easiest thing you'll notice about time zones in R is the Sys.timezone command. And I'll pull it up here. And what this tells us is our current time zone location. Now, that time zone is dependent on the operating system. In my case, I'm using a Macintosh and so I've gone to the location control panel. Let's pull that up now. I'll go to the System Preferences, and then I go to Date & Time. In Date & Time, there is a place to set the time zone and you can see that I'm currently located in Portland with a time zone of…

Contents