I have a number of seconds count, for example, 713 seconds. How can I implement an Angular.js filter that converts this 713 seconds to HH:mm:ss format? In this case, it shou
app.filter('formatTimer', function () {
return function (input) {
function z(n) { return (n < 10 ? '0' : '') + n; }
var seconds = input % 60;
var minutes = Math.floor(input % 3600 / 60);
var hours = Math.floor(input / 3600);
return (z(hours) + ':' + z(minutes) + ':' + z(seconds));
};
will output: 02:04:14