How to create new date in JavaScript ES6

3 Answers

0 votes
const date = new Date();

console.log(date);




/*
run:
   
2020-03-23T09:22:21.787Z

*/

 



answered Mar 23, 2020 by avibootz
0 votes
const date = new Date(1591671106033);

console.log(date);




/*
run:
   
2020-06-09T02:51:46.033Z

*/

 



answered Mar 23, 2020 by avibootz
0 votes
const date = new Date("2020-03-23");

console.log(date);




/*
run:
   
2020-03-23T00:00:00.000Z

*/

 



answered Mar 23, 2020 by avibootz
...