How to convert an ISO date to the date format yyyy-mm-dd in Node.js

1 Answer

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

console.log(date.toISOString().substring(0, 10));
 
  
  
  
/*
run:
  
2023-07-14
  
*/

 



answered Apr 4, 2022 by avibootz

Related questions

1 answer 171 views
1 answer 153 views
1 answer 123 views
1 answer 124 views
...