How to convert a date to a timestamp in JavaScript

1 Answer

0 votes
const date = new Date('2022-03-20');

const timestamp = date.getTime();

console.log(timestamp); 

  
  
  
  
/*
run:
  
1647734400000
  
*/

 



answered Mar 20, 2022 by avibootz

Related questions

1 answer 136 views
1 answer 157 views
1 answer 120 views
1 answer 149 views
6 answers 375 views
375 views asked Jun 29, 2022 by avibootz
1 answer 156 views
1 answer 121 views
...