How to get the current date and time in seconds using TypeScript

1 Answer

0 votes
const currentDate = new Date();

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

console.log(seconds);


  
  
  
  
/*
run:
  
1646387624 
  
*/

 



answered Mar 4, 2022 by avibootz
...