Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def normalize_duration(duration)
(Time.gm(2000) + duration.split(":").inject(0){|a,b| a*60+b.to_i}).strftime("%H:%M:%S").gsub(/^(0|:)*/, '')
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment