How to remove seconds and milliseconds from a date in Note.js

1 Answer

0 votes
const date = new Date('2024-05-20T12:09:30.724Z');

date.setSeconds(0, 0);

console.log(date.toISOString()); 

  
  
  
/*
run:
  
2024-05-20T12:09:00.000Z
  
*/

 



answered Mar 20, 2022 by avibootz
...