How to convert an ISO date to the date format yyyy-mm-dd in TypeScript

1 Answer

0 votes
const date = new Date('2021-03-14T17:19:06Z');

console.log(date.toISOString().substring(0, 10));

 
  
  
  
/*
run:
  
"2021-03-14" 
  
*/

 



answered Apr 4, 2022 by avibootz

Related questions

...