javascipt date get month and year 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: how to get only month and year in js
let dateObj = new Date();
let myDate = (dateObj.getUTCFullYear()) + "/" + (dateObj.getMonth() + 1)+ "/" + (dateObj.getUTCDate());
Example 3: js get day month year
const d = new Date();
d.getMonth() + 1;
d.getDate();
d.getFullYear();