JSFiddle - React, Tailwind, and code Playground
by Emre Erkan
HTML
<input type="text" id="sn" />
<input type="text" id="time" />
<input type="button" id="convert" value="Dönüştür" />
JavaScript
Number.prototype.toTime = function() {
var h = Math.floor(this / 3600), m = Math.floor((this - h * 3600) / 60), s = this - (h * 3600 + m * 60);
return [ h < 10 ? 0 : '', h, ':', m < 10 ? 0 : '', m, ':', s < 10 ? 0 : '', s].join('');
}
$(document).on('click', '#convert', function(e) {
e.preventDefault();
$('#time').val(parseInt($('#sn').val(), 10).toTime());
});