How to display the time in TypeScript

3 Answers

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



  
/*
run:
 
1653553475382 
  
*/

 



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

 



answered May 26, 2022 by avibootz
0 votes
const d = new Date();  
    
console.log(d.getHours() +':'+ d.getMinutes() +':'+ d.getSeconds() +':'+ d.getMilliseconds());
 
 
 
   
/*
run:
  
"11:26:33:5" 
   
*/

 



answered May 26, 2022 by avibootz
...