span <- new_interval(as.POSIXct("2009-01-01"), as.POSIXct("2010-02-02 01:01:01")) #interval
# 397.0424 days beginning at 2009-01-01
as.period(span)
# 1 year, 1 month, 1 day, 1 hour, 1 minute and 1 second
as.period(span, units = c("year"))
# 1 year and 2768461 seconds
as.period(span, units = c("day", "minute"))
# 1 day, 1 minute and 34218001 seconds}
Run the code above in your browser using DataLab