How to remove seconds and milliseconds from a date in TypeScript

1 Answer

0 votes
const date = new Date('2023-04-01T12:04:28.724Z');

date.setSeconds(0, 0);

console.log(date.toISOString()); 

  
  
  
/*
run:
  
"2023-04-01T12:04:00.000Z"
  
*/

 



answered Mar 20, 2022 by avibootz
...