date year month day javascript code example
Example 1: js get date day month year
var dateObj = new Date();
var month = dateObj.getUTCMonth() + 1;
var day = dateObj.getUTCDate();
var year = dateObj.getUTCFullYear();
newdate = year + "/" + month + "/" + day;
Example 2: js get day month year
const d = new Date();
d.getMonth() + 1;
d.getDate();
d.getFullYear();
Example 3: javascript get day of year from date
var myDate = new Date(2019, 11, 06, 10, 45);
var dayInYear = Math.floor((myDate - new Date(myDate.getFullYear(), 0, 0)) / (1000 * 60 * 60 * 24));
Example 4: javascript date
const d = new Date();
d.getFullYear();
d.getMonth();
d.getDate();
d.getHours();
d.getMinutes();
d.getSeconds();
d.getMilliseconds();
d.getTime();