[Javascript] someJavascript (Date)
#script src="myscript.js"##/script#
>>> Before closing body tag
const myDate = new Date()
const myDayList = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
const myMonthList = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
const myDate = new Date();
let myYear = myDate.getFullYear();
let myRawMonth = myDate.getMonth();
let myDayNumber = myDate.getDate();
let myRawDayName = myDate.getDay();
let myMonth = myMonthList[myRawMonth];
let myDayName = myDayList[myRawDayName];
myDateArray = [myYear, myMonth, myDayNumber, myDayName];
myDateString = myDateArray.join(" ");
alert(myDateString);
const myDate = new Date(2023, 1, 2);
// Beware the month is of 0 based
alert(myDate);
myDate.setFullYear(1992);
myDate.setMonth(5);
myDate.setDate(19);
alert(myDate.toString());
alert(myDate.toUTCString());
alert(myDate.toLocaleString());
alert(myDate.toDateString());
alert(myDate.toTimeString());
Source: ---
Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.