I am receiving a string in this format 'HH:mm:ss'
. I would like to remove the leading zeros but always keeping the the last four character eg m:ss
even if m
would be a zero. I am formatting audio duration.
Examples:
00:03:15
=> 3:15
10:10:10
=> 10:10:10
00:00:00
=> 0:00
04:00:00
=> 4:00:00
00:42:32
=> 42:32
00:00:18
=> 0:18
00:00:08
=> 0:08
If you use 1 h instead of two you will not get the leading 0.
h:mm:ss
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