convert milliseconds to time javascript
function msToTime(s) {
// Pad to 2 or 3 digits, default is 2
function pad(n, z) {
z = z || 2;
return ('00' + n).slice(-z);
}
var ms = s % 1000;
s = (s - ms) / 1000;
var secs = s % 60;
s = (s - secs) / 60;
var mins = s % 60;
var hrs = (s - mins) / 60;
return pad(hrs) + ':' + pad(mins) + ':' + pad(secs) + '.' + pad(ms, 3);
}
console.log(msToTime(55018))const miliseconds = 1604395966369;
const date = new Date(miliseconds);
Also in JavaScript:
- how to get value of input in javascript
- js set visibility on timeout
- delete backspace on string js
- fizzbuzz js
- $('#mymodal').modal('show') not working
- react native notifications error
- javascript string starts with
- row append and calculation in jquery datatable
- how to make a translator in python
- How to check if a member has a role discord.js
- i18n react meta description
- how to check if 2 images are touching js
- Setting “checked” for a checkbox with jQuery
- use ca certifcate node js
- angular form validation
- history.pushstate
- javascript get list of class names
- onclick Event jquery
- create server and connect to db and frontend
- how to set time out in js
- js delete all array items
- javascript regex not in a set of characters
- onswitch from tab do something jquery
- how to get a channelid discord.js