
// Date program beginning

function MakeArray(n) {
	this.length = n;
	return this;
}

<!-- Give the week days -->

wkName = new MakeArray(6);
wkName[1] = "Monday";
wkName[2] = "Tuesday";
wkName[3] = "Wednesday";
wkName[4] = "Thursday";
wkName[5] = "Friday";
wkName[6] = "Saturday";
wkName[0] = "Sunday";

<!-- Give the month names -->

mthName = new MakeArray(12);
mthName[1] = "January";
mthName[2] = "February";
mthName[3] = "March";
mthName[4] = "April";
mthName[5] = "May";
mthName[6] = "June";
mthName[7] = "July";
mthName[8] = "August";
mthName[9] = "September";
mthName[10] = "October";
mthName[11] = "November";
mthName[12] = "December";

function displayDate() {
currentTime = new Date();
var thisDay = wkName[currentTime.getDay()];
var thisDate = currentTime.getDate();
var thisMonth = mthName[currentTime.getMonth() + 1];
var thisYear = currentTime.getFullYear();
var thisSuffix;
if ((thisDate == 1) || (thisDate == 21) || (thisDate == 31))
thisSuffix = "st"
else if ((thisDate == 2) || (thisDate == 22))
thisSuffix = "nd"
else if ((thisDate == 3) || (thisDate == 23))
thisSuffix = "rd"
else
thisSuffix = "th";
var thisTime = " " + thisDay + " " + thisDate + "" + thisSuffix + " " + thisMonth + " " + thisYear + "" ; 
document.write(thisTime);
}