How to get the current date and time in TypeScript

2 Answers

0 votes
console.log(new Date());
 
 
 
/*
run:
 
Date: "2022-02-27T10:47:27.135Z" 
 
*/

 



answered Feb 27, 2022 by avibootz
0 votes
console.log(new Date().toDateString());
 
 
 
/*
run:
 
"Sun Feb 27 2022" 
 
*/

 



answered Feb 27, 2022 by avibootz

Related questions

1 answer 168 views
1 answer 143 views
1 answer 178 views
1 answer 110 views
...