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 251 views
1 answer 271 views
1 answer 232 views
1 answer 198 views
...