js date how 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 currentDate = new Date();
var dateFromTimeStamp= new Date(1560807962);
var dateFromString = new Date('December 17, 1995 03:24:00');
var dateFromYearMonthDay = new Date(2018, 11, 26, 0, 0, 0, 0);