I was wondering if we can round off period
to nearest minutes using lubridate
. For ex - the value of time_diff
is "2H 13M 9S". How can I get round off time_diff
to nearest minute to get "2H 13M" (remove seconds)
library(lubridate)
time_1 <- ymd_hms("2021-01-01 12:12:36")
time_2 <- ymd_hms("2021-01-01 14:25:45")
time_diff <- seconds_to_period(difftime(time_2, time_1, units = 'sec'))