Skip to content

Instantly share code, notes, and snippets.

@emberian
Forked from anonymous/gist:2018992
Created March 12, 2012 01:00
Show Gist options
  • Save emberian/2019014 to your computer and use it in GitHub Desktop.
Save emberian/2019014 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(":")
var seconds = parseInt(split.pop())
if (seconds !== NaN) {
var minutes = parseInt(split.pop())
if (minutes !== NaN) {
var hours = parseInt(split.pop())
if (hours !== NaN) {
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