Skip to content

Instantly share code, notes, and snippets.

Created January 17, 2016 21:08
Show Gist options
  • Select an option

  • Save anonymous/f5da89124c04a1cd2143 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/f5da89124c04a1cd2143 to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/zutuniy
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<p id="text"></p>
<script>
var filterTimeCode = function filterTimeCode(timeInSeconds) {
var totalSeconds = parseFloat(timeInSeconds);
var minutes = Math.floor(totalSeconds / 60);
var seconds = Math.floor(totalSeconds % 60);
return minutes + ':' + seconds;
};
document.getElementById("text").innerHTML = filterTimeCode(101.43);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment