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 136 views
1 answer 142 views
1 answer 148 views
1 answer 173 views
1 answer 188 views
1 answer 206 views
...