Skip to content

Instantly share code, notes, and snippets.

@SuperOleg39
Created December 1, 2017 13:20
Show Gist options
  • Select an option

  • Save SuperOleg39/828901bdf9cae002f3dc2c6cfb5edbff to your computer and use it in GitHub Desktop.

Select an option

Save SuperOleg39/828901bdf9cae002f3dc2c6cfb5edbff to your computer and use it in GitHub Desktop.
function getMinutes(time: number): string {
const minutes = Math.floor(time / (60 * 1000)).toString();
return minutes.length > 1 ? minutes : '0' + minutes;
}
function getSeconds(time: number): string {
const seconds = Math.round((time % (60 * 1000)) / 1000).toString();
return seconds.length > 1 ? seconds : '0' + seconds;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment