How to display the time in Node.js

3 Answers

0 votes
const d = new Date();  
   
console.log(d.getTime());



  
/*
run:
 
1653553681970 
  
*/

 



answered May 26, 2022 by avibootz
0 votes
const d = new Date();  
    
console.log(d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds());
 
 
 
   
/*
run:
  
8:29:10
   
*/

 



answered May 26, 2022 by avibootz
0 votes
const d = new Date();  
    
console.log(d.getHours() +':'+ d.getMinutes() +':'+ d.getSeconds() +':'+ d.getMilliseconds());
 
 
 
   
/*
run:
  
8:29:53:213
   
*/

 



answered May 26, 2022 by avibootz

Related questions

2 answers 388 views
388 views asked Jan 23, 2022 by avibootz
1 answer 204 views
1 answer 240 views
1 answer 221 views
1 answer 229 views
1 answer 215 views
...