Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2012 00:58
Show Gist options
  • Save anonymous/2018992 to your computer and use it in GitHub Desktop.
Save anonymous/2018992 to your computer and use it in GitHub Desktop.
a guest on Mar 11th, 2012 - pastebin.com/0DWetuis
function secondsFromTime(string){
var split = string.split(":");
if(seconds = parseInt(split.pop()) ){
if(minutes = parseInt(split.pop()) ){
if(hours = parseInt(split.pop()) ){
return hours * 60 * 60 + minutes * 60 + seconds;
} else return minutes*60 + seconds;
} else return seconds;
}else return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment