int_duration | R Documentation |
Interval
objectint_duration()
computes the duration of an
Interval
object
int_duration(int = NULL)
int |
An |
A Duration
vector.
Other Interval functions:
int_mean()
,
int_overlap()
lubridate::interval(
lubridate::ymd_hms("2023-01-01 22:00:01", tz = "UTC"),
lubridate::ymd_hms("2023-01-02 02:00:01", tz = "UTC"),
tzone = "UTC"
) |>
int_duration()
#> [1] "14400s (~4 hours)" # Expected
lubridate::interval(
lubridate::ymd_hms("2023-01-01 22:00:01", tz = "UTC"),
lubridate::ymd_hms("2023-01-02 02:00:01", tz = "UTC"),
tzone = "UTC"
) |>
int_duration() |>
lubridate::as.period()
#> [1] "4H 0M 0S" # Expected
c(
lubridate::interval(
lubridate::ymd_hms("2023-01-01 22:00:01", tz = "UTC"),
lubridate::ymd_hms("2023-01-02 02:00:01", tz = "UTC"),
tzone = "UTC"
),
lubridate::interval(
lubridate::ymd_hms("1990-01-01 06:00:00", tz = "UTC"),
lubridate::ymd_hms("1990-01-01 12:00:00", tz = "UTC"),
tzone = "UTC"
)
) |>
int_duration()
#> [1] "14400s (~4 hours)" "21600s (~6 hours)" # Expected
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.