node js unix timestamp code example
Example 1: how to format unix timestamp javascript
var s = new Date(1504095567183).toLocaleDateString("en-US")
// expected output "8/30/2017"
console.log(s);
Example 2: node get unix timestamp
Math.floor(new Date() / 1000) // in seconds
Example 3: nodejs current timestamp unix
Math.floor(+new Date() / 1000)
Example 4: node js unix timestamp
function getUnixTime() {
return (Date.now() / 1000) | 0;
}
Example 5: nodejs current timestamp
Math.floor(new Date() / 1000)