Session Ready
Exercise

Setting the timezone

If you import a datetime and it has the wrong timezone, you can set it with force_tz(). Pass in the datetime as the first argument and the appropriate timezone to the tzone argument. Remember the timezone needs to be one from OlsonNames().

I wanted to watch New Zealand in the Women's World Cup Soccer games in 2015, but the times listed on the FIFA website were all in times local to the venues. In this exercise you'll help me set the timezones, then in the next exercise you'll help me figure out what time I needed to tune in to watch them.

Instructions
100 XP

I've put the times as listed on the FIFA website for games 2 and 3 in the group stage for New Zealand in your code.

  • Game 2 was played in Edmonton. Use force_tz() to set the timezone of game 2 to "America/Edmonton".
  • Game 3 was played in Winnipeg. Use force_tz() to set the timezone of game 3 to "America/Winnipeg".
  • Find out how long the team had to rest between the two games, by using as.period() on the interval between game2_local and game3_local.