w3schools date js code example
Example 1: new date javascript
let today = new Date();
let birthday = new Date("December 17, 1995 03:24:00");
let birthday = new Date("1995-12-17T03:24:00");
let birthday = new Date(1995, 11, 17);
let birthday = new Date(1995, 11, 17, 3, 24, 0);
let birthday = new Date(628021800000);
let [month, date, year] = new Date().toLocaleDateString("en-US").split("/");
let [hour, minute, second] = new Date()
.toLocaleTimeString("en-US")
.split(/:| /);
let date = new Date(98, 1);
date.setYear(98);
date.setFullYear(98);
Example 2: javascript date
var d= new Date();
d.getFullYear();
d.getMonth();
d.getDate();
d.getHours();
d.getMinutes();
d.getSeconds();
d.getMilliseconds();
d.getTime();
Example 3: dates in javascript
new Date();
Date.now();
new Date(year, month, day hours, minutes, seconds, milliseconds)
Example 4: new date javascript
let local_date = new Date();
alert("it is " + local_date + "!")