javascript number to date code example
Example 1: js date methods
var d= new Date();
d.getFullYear();
d.getMonth();
d.getDate();
d.getHours();
d.getMinutes();
d.getSeconds();
d.getMilliseconds()
d.getTime();
d.getDay();
d.Date.now();
d.setDate()
d.setFullYear()
d.setHours()
d.setMilliseconds()
d.setMinutes()
d.setMonth()
d.setSeconds()
d.setTime()
Example 2: datetime to date javascript
var currentDate = new Date();
var date = currentDate.getDate();
var month = currentDate.getMonth();
var year = currentDate.getFullYear();
var dateString = date + "-" +(month + 1) + "-" + year;
Example 3: 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);
Example 4: js get day month year
const d = new Date();
d.getMonth() + 1;
d.getDate();
d.getFullYear();