javascript datetime format w3schools code example

Example 1: dates in javascript

new Date();
// Sat Jan 16 2021 22:08:57 GMT-0500 (Eastern Standard Time)
Date.now();
// 1610852869057  -> Seconds passed since Jan 1,1970

// Set the date
new Date(year, month, day hours, minutes, seconds, milliseconds)

Example 2: javascript date

const d = new Date();
d.getFullYear(); // 2020
d.getMonth(); // October
d.getDate(); // 4
d.getHours(); // 11
d.getMinutes(); // 20
d.getSeconds(); // 12
d.getMilliseconds(); // 0
d.getTime(); // ????????????