How to convert DD-MM-YYYY to YYYY-MM-DD format in TypeScript

1 Answer

0 votes
let date = '17-03-2022';
 
date = date.split("-").reverse().join("-");
 
console.log(date); 
 
   
   
   
   
/*
run:
   
"2022-03-17" 
   
*/

 



answered Mar 16, 2022 by avibootz
...