how to get date from date object in javascript code example
Example 1: get date javascript
var d= new Date();
d.getFullYear();
d.getMonth();
d.getDate();
d.getHours();
d.getMinutes();
d.getSeconds();
d.getMilliseconds();
d.getTime();
Example 2: javascript get day of year
const dayOfYear = date => Math.floor((date - new Date(date.getFullYear(), 0, 0)) / (1000 * 60 * 60 * 24));
dayOfYear(new Date(2020, 04, 16));
Example 3: get date in javascript
function getTodayDate() {
let d = new Date();
return d;
}
console.log(getTodayDate());