This function computes the duration of an interval given its start and end points.
int_duration(start, end)
A Period
object representing the duration of
the interval.
## Scalar example
int_duration(
start = lubridate::dmy_hms("15/01/2023 09:57:35", tz = "UTC"),
end = lubridate::dmy_hms("18/01/2023 23:59:35", tz = "UTC")
)
#> [1] "3d 14H 2M 0S"
#> [1] "3d 14h 2m 0s" # Expected
## Vector example
int_duration(
start = lubridate::dmy_hms(
c("15/01/2023 09:57:35", "18/01/2023 09:57:35"),
tz = "UTC"
),
end = lubridate::dmy_hms(
c("18/01/2023 23:59:35", "20/01/2023 23:59:35"),
tz = "UTC"
)
)
#> [1] "3d 14H 2M 0S" "2d 14H 2M 0S"
#> [1] "3d 14h 2m 0s" "2d 14h 2m 0s" # Expected