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 246 views
1 answer 263 views
1 answer 224 views
1 answer 191 views
...