Reputation: 1644
How could we change the period element "19H 43M 0S" to "19:43:00" (specifically "%H:%M:%S" format) in R?
Upvotes: 0
Views: 208
Reputation: 887911
We can use sprintf
with get the format
library(lubridate)
sprintf("%02d:%02d:%02d", hour(v1), minute(v1), second(v1))
#[1] "19:43:00"
v1 <- period("19hours 43minutes")
Upvotes: 1