How to get date and time in locale format with Node.js

1 Answer

0 votes
const date = new Date();

console.log(date.toLocaleString()); 

console.log(date.toLocaleDateString());

console.log(date.toLocaleTimeString());

  
  
  
  
/*
run:
  
3/15/2022, 7:21:11 AM
3/15/2022
7:21:11 AM
  
*/

 



answered Mar 15, 2022 by avibootz

Related questions

1 answer 131 views
1 answer 131 views
1 answer 140 views
1 answer 166 views
1 answer 180 views
1 answer 198 views
...