Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

formatDuration js

String.prototype.toHHMMSS = function () {
    var sec_num = parseInt(this, 10); // don't forget the second param
    var hours   = Math.floor(sec_num / 3600);
    var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
    var seconds = sec_num - (hours * 3600) - (minutes * 60);

    if (hours   < 10) {hours   = "0"+hours;}
    if (minutes < 10) {minutes = "0"+minutes;}
    if (seconds < 10) {seconds = "0"+seconds;}
    return hours+':'+minutes+':'+seconds;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: chrome extension sendmessage await until getdata 
Javascript :: how stop users from submitting empty input in todo list javascript 
Javascript :: how to read textbox values from html and insert them into tables using java script 
Javascript :: can i pack a cross excutable file with nodejs 
Javascript :: how to mask credit card number in javascript 
Javascript :: form react js 
Javascript :: vanilla js for each element add attribute 
Javascript :: Installation de react native maps bibliothèque 
Javascript :: javascript perms 
Javascript :: pASS - EXE 
Javascript :: sending string variable to .net mvc using Ajax JQuery 
Javascript :: express plus make router 
Javascript :: vscode php format brackets 
Javascript :: types of directive in jsp 
Javascript :: JavaScript program that on button click displays the current timestamp on screen 
Javascript :: Merge Arrarys of Object of Any size 
Javascript :: how to use props data inside setup 
Javascript :: mixed line chart for angular or react 
Javascript :: faster filter array in JavaScript 
Javascript :: finalGrade % 5 && <38 
Javascript :: truty values in javascript 
Javascript :: How to create a debounce higher order function 
Javascript :: make a table of data from db in jsp 
Javascript :: await multiple promises 
Javascript :: reactrouter 
Javascript :: Fix the transition judder at 0/60 seconds javascript30 js clock 
Javascript :: getComments 
Javascript :: ngclass click change toggle 
Javascript :: fetch Mongodb find() results with Backbone 
Javascript :: pause media stream javascript 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =