1var dateObj = new Date();
2var month = dateObj.getUTCMonth() + 1; //months from 1-12
3var day = dateObj.getUTCDate();
4var year = dateObj.getUTCFullYear();
5
6newdate = year + "/" + month + "/" + day;
7
1const d = new Date();
2
3d.getMonth() + 1; // Month [mm] (1 - 12)
4d.getDate(); // Day [dd] (1 - 31)
5d.getFullYear(); // Year [yyyy]
1var d= new Date();
2d.getFullYear();//Get the year as a four digit number (yyyy)
3d.getMonth();//Get the month as a number (0-11)
4d.getDate();//Get the day as a number (1-31)
5d.getHours();//Get the hour (0-23)
6d.getMinutes();//Get the minute (0-59)
7d.getSeconds();//Get the second (0-59)
8d.getMilliseconds();//Get the millisecond (0-999)
9d.getTime();//Get the time (milliseconds since January 1, 1970)
1//create an object first to indicate what values you want to output
2var today = new Date();
3var options = {
4 weekday: "long", //to display the full name of the day, you can use short to indicate an abbreviation of the day
5 day: "numeric",
6 month: "long", //to display the full name of the month
7 year: "numeric"
8}
9//indicate the language you want it in first then use the options object for your values
10var sDay = today.toLocaleDateString("en-US", options);