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]
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);