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 276 views
276 views asked Jan 23, 2022 by avibootz
1 answer 109 views
1 answer 169 views
1 answer 137 views
1 answer 141 views
1 answer 114 views
...