Skip to content

Instantly share code, notes, and snippets.

@SteKoe
Created January 31, 2016 12:47
Show Gist options
  • Save SteKoe/868c4ffbf8ce8b55c732 to your computer and use it in GitHub Desktop.
Save SteKoe/868c4ffbf8ce8b55c732 to your computer and use it in GitHub Desktop.
Convert a given time string hh:mm:ss to the actual seconds
// E.g.: 02:09:07 will result in 7747 seconds
timeStr.split(':')
.reverse()
.map((part, idx) => Math.pow(60, idx) * +part)
.reduce((prev, cur) => prev + cur, 0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment