Run
Save
Help
Keyboard Shortcuts
CTRL
+
Return
Run fiddly
CTRL
+
S
Save fiddly
CTRL
+
E
New fiddly
CTRL
+
Shift
+
Backspace
Reset Layout
Note:
Press
F11
when cursor is in the editor to toggle full screen editing.
Share link
Share full screen result
Embed on your website
Meta
Add library
jQuery 1.6.3
jQuery 1.7.2
jQuery 1.8.3
jQuery 2.1.0 Latest
Prototype 1.6.1
Prototype 1.7 Latest
YUI 3.10.0
YUI 2.9.0
MooTools 1.5.0
Dojo 1.8.4
Angular Latest
Angular 1.4.0 Stable
RequireJS 2.1.14
React with Add-Ons 0.14.3
ES5 shim 4.4.0
Ember 2.2.0
ThreeJS r73
how to convert seconds to hh:mm:ss with javascript
Share
Latest edits
1.
1
Flex-box css properties
2022-05-29 09:53:05
2.
1
How to draw a triangle using CSS
2022-05-28 11:01:05
3.
1
RegEx for device name from user agent in javascript
2022-05-16 06:49:05
4.
1
Open whatsapp chat without save mobile number
2022-01-14 09:15:01
5.
1
navigator platform userAgent javascript
2020-12-29 07:12:12
6.
1
Window rename multiple file with pattern
2020-11-27 06:24:11
7.
1
How to check incognito in javascript
2020-08-07 11:07:08
8.
1
test
2020-06-12 00:52:06
More Posts
HTML
<div> Code: </div> <pre> function formatSeconds(sec) { return appendZero(sec / 3600) + ':' + appendZero((sec % 3600) / 60) + ':' + appendZero((sec % 3600) % 60); } function appendZero(num) {num = parseInt(num);return num < 10 ? '0' + num : num;} </pre> <br/> <br/> Output : <br/><br/> <input type="text" id="sec" value="3600"/><input type="button" value="Submit" onclick="format();"/><br/><br/> <div id = "result"/>
CSS
JS
function formatSeconds(sec) { return appendZero(sec / 3600) + ':' + appendZero((sec % 3600) / 60) + ':' + appendZero((sec % 3600) % 60); } function appendZero(num) {num = parseInt(num);return num < 10 ? '0' + num : num;} function format() { var num = document.querySelector('#sec').value; if(!isNaN(num)) { document.querySelector("#result").innerHTML = 'Result : - ' + formatSeconds(num); } else { document.querySelector("#result").innerHTML = 'Invalid Number'; } } format();