How to get the current timestamp in Node.js

1 Answer

0 votes
const ts = Date.now();

console.log(ts, "milliseconds");

console.log(Math.floor(ts/1000), "seconds");



/*
run:

1584604874792 milliseconds
1584604874 seconds

*/

 



answered Mar 19, 2020 by avibootz

Related questions

1 answer 163 views
1 answer 206 views
1 answer 120 views
1 answer 154 views
1 answer 143 views
2 answers 124 views
1 answer 77 views
...