How to get date and time in locale format with TypeScript

1 Answer

0 votes
const date = new Date();

console.log(date.toLocaleString()); 

console.log(date.toLocaleDateString());

console.log(date.toLocaleTimeString());

  
  
  
  
/*
run:
  
"15/03/2022, 09:04:27" 
"15/03/2022" 
"09:04:27" 
  
*/

 



answered Mar 15, 2022 by avibootz

Related questions

1 answer 128 views
1 answer 142 views
1 answer 212 views
1 answer 160 views
...