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 223 views
1 answer 229 views
1 answer 255 views
1 answer 281 views
1 answer 263 views
1 answer 295 views
...