How to get date and time parts in JavaScript ES6

1 Answer

0 votes
const date = new Date(Date.now());

console.log(`${date.getDate()}-${date.getMonth() + 1}-${date.getFullYear()}`);
console.log(`${date.getHours()}:${date.getSeconds()}:${date.getMilliseconds()}`);




/*
run:
   
23-3-2020
17-40-913

*/

 



answered Mar 23, 2020 by avibootz

Related questions

...