slim
06-06-2003, 10:50 AM
Hi,
I am workinng on a website for a friend and I was wondering if you can be of existence.
The problem I have got is with a javascript which creates the current date on the webpage.
At the moment it displays "Tuesday, June 6, 2003", but we would like to change it to show "Tuesday, 6th June, 2003". I assume it needs another array for "st","th","nd" etc.
Any help is appreciated.
Slim
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";
today = new Date(); day = days[today.getDay() + 1]
month = months[today.getMonth() + 1]
date = today.getDate()
year=today.getYear();
if (year < 2000)
year = year + 1900;
document.write ("<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> "+ day +
", " + month + " " + date + ", " + year + "</font>")
// -- end hiding
I am workinng on a website for a friend and I was wondering if you can be of existence.
The problem I have got is with a javascript which creates the current date on the webpage.
At the moment it displays "Tuesday, June 6, 2003", but we would like to change it to show "Tuesday, 6th June, 2003". I assume it needs another array for "st","th","nd" etc.
Any help is appreciated.
Slim
days = new Array(7)
days[1] = "Sunday";
days[2] = "Monday";
days[3] = "Tuesday";
days[4] = "Wednesday";
days[5] = "Thursday";
days[6] = "Friday";
days[7] = "Saturday";
months = new Array(12)
months[1] = "January";
months[2] = "February";
months[3] = "March";
months[4] = "April";
months[5] = "May";
months[6] = "June";
months[7] = "July";
months[8] = "August";
months[9] = "September";
months[10] = "October";
months[11] = "November";
months[12] = "December";
today = new Date(); day = days[today.getDay() + 1]
month = months[today.getMonth() + 1]
date = today.getDate()
year=today.getYear();
if (year < 2000)
year = year + 1900;
document.write ("<font size=-2 face='Arial, Helvetica, sans-serif' color=003399> "+ day +
", " + month + " " + date + ", " + year + "</font>")
// -- end hiding