Working with Dates and Times in R
Charlotte Wickham
Instructor
release_time <- releases$datetime
head(release_time)
"1997-12-04 08:47:58 UTC" "1997-12-21 13:09:22 UTC"
"1998-01-10 00:31:55 UTC" "1998-03-14 19:25:55 UTC"
"1998-05-02 07:58:17 UTC" "1998-06-14 12:56:20 UTC"
head(release_time) %>% hour()
8 13 0 19 7 12
head(release_time) %>% floor_date(unit = "hour")
"1997-12-04 08:00:00 UTC" "1997-12-21 13:00:00 UTC"
"1998-01-10 00:00:00 UTC" "1998-03-14 19:00:00 UTC"
"1998-05-02 07:00:00 UTC" "1998-06-14 12:00:00 UTC"
round_date()
- round to nearestceiling_date()
- round upfloor_date()
- round to downunit
:"second"
, "minute"
, "hour"
, "day"
, "week"
, "month"
, "bimonth"
, "quarter"
, "halfyear"
, or "year"
."2 years"
, "5 minutes"
Working with Dates and Times in R