### ** Examples
duration(3690, "seconds")
[1] "3690s (~1.02 hours)"
period(second = 30, minute = 1, hour = 1)
interval(ymd_hms("2009-08-09 13:01:30"), ymd_hms("2009-08-09 12:00:00"))
[1] 2009-08-09 13:01:30 UTC--2009-08-09 12:00:00 UTC
date <- ymd_hms("2009-03-08 01:59:59") # DST boundary
date + days(1)
[1] "2009-03-09 01:59:59 UTC"
[1] "2009-03-09 01:59:59 UTC"
date2 <- ymd_hms("2000-02-29 12:00:00")
date2 + years(1)
# self corrects to next real day
date3 <- ymd_hms("2009-01-31 01:00:00")
date3 + c(0:11) * months(1)
[1] "2009-01-31 01:00:00 UTC" NA
[3] "2009-03-31 01:00:00 UTC" NA
[5] "2009-05-31 01:00:00 UTC" NA
[7] "2009-07-31 01:00:00 UTC" "2009-08-31 01:00:00 UTC"
[9] NA "2009-10-31 01:00:00 UTC"
[11] NA "2009-12-31 01:00:00 UTC"
span <- date2 %--% date #creates interval
date <- ymd_hms("2009-01-01 00:00:00")
date + years(1)
date - days(3) + hours(6)
[1] "2008-12-29 06:00:00 UTC"
[1] "2009-01-01 00:00:30 UTC"