I have recently changed to CodeWars to make practice my Elixir skills. To complete an exercise I need to convert seconds to compound duration. This looks complex, but in reality is something most developers did at one time or another:
Write a function or program which:
- takes a positive integer representing a duration in seconds as input (e.g.,
- returns a string which shows the same duration decomposed into hours, minutes, and seconds like: “01|20|34” ( 1 hour, 20 minutes, 34 seconds ).
Each string needs to have 2 digits.
I noticed that some languages like Julia already have a function that does this. I wonder if Elixir / Erlang, with so many years going on, also has one.
Does any one know of an native function that helps me accomplish this without having to reinvent the wheel all over again?