javascript convert timestamp to date and time code example
Example 1: how to format unix timestamp javascript
var s = new Date(1504095567183).toLocaleDateString("en-US")
console.log(s);
Example 2: timestamp to date javascript
let unix_timestamp = 1549312452
var date = new Date(unix_timestamp * 1000);
var hours = date.getHours();
var minutes = "0" + date.getMinutes();
var seconds = "0" + date.getSeconds();
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2);
console.log(formattedTime);