How to get the current date and time in seconds using Node.js

1 Answer

0 votes
const currentDate = new Date();

const seconds = Math.floor(currentDate.getTime() / 1000);

console.log(seconds);

  
  
  
  
/*
run:
  
1646387816

*/

 



answered Mar 4, 2022 by avibootz

Related questions

...