Dates and times: complications
A number of things contribute to dates and times being more complex than one might think.
- Not all years have 365 days
- The actual rule that determines leap years:
A year is a leap year if it’s divisible by 4, unless it’s also divisible by 100, except if it’s also divisible by 400. In other words, in every set of 400 years, there’s 97 leap years.
- Not every day in every location has 24 hours a day
- Daylight savings time implies one day has 23, another has 24
- Time zones are difficult!
- We will be using lubridate package (part of latest tidyverse), and nycflights13.
library(tidyverse) library(nycflights13)