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 120 views
1 answer 132 views
1 answer 203 views
1 answer 153 views
...