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

1 Answer

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

console.log(date.toISOString().substring(0, 10));
 
  
  
  
/*
run:
  
"2022-02-14"
  
*/

 



answered Apr 4, 2022 by avibootz
edited Apr 4, 2022 by avibootz

Related questions

...