JSFiddle - React, Tailwind, and code Playground
by maharajan a
JavaScript
var start = new Date;
var getSeconds=0;
setInterval(function() {
$('.Timer').text((new Date - start) / 1000 + " Seconds");
}, 1000);
function getDuration()
{
// total seconds
var seconds = 344234;
// calculate seconds
var s = seconds % 60;
// add leading zero to seconds if needed
s = s < 10 ? "0" + s : s;
// calculate minutes
var m = Math.floor(seconds / 60) % 60;
// add leading zero to minutes if needed
m = m < 10 ? "0" + m : m;
// calculate hours
var h = Math.floor(seconds / 60 / 60);
var time = h + ":" + m + ":" + s
alert(time);
}