I have a number 154958
. I want to convert to HH:MM:SS
.
Answer I am looking is 15:49:58
.
Convert to date then substring:
substr(strptime("154958", format = "%H%M%S"), 12, 20)
Or even better version (thanks @Roland):
format(strptime("154958", format = "%H%M%S"), format = "%H:%M:%S")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With