Skip to content

Instantly share code, notes, and snippets.

@hitode909
Created November 25, 2009 11:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitode909/242656 to your computer and use it in GitHub Desktop.
Save hitode909/242656 to your computer and use it in GitHub Desktop.
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