return to homepage

Scripts: Javascript

Time and Date

This following script allows you to determine the time and the date from your PC's clock. This does rely on the person viewing the web page having the clock set correctly.

English (UK) long date format:
English (UK) short date format:

American (US) long date format:
American (US) short date format:

<SCRIPT language="JavaScript">
<!--
// Creates date array

dayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")

monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

monNum = new Array ("01","02","03","04","05","06","07","08","09","10","11","12")
now = new Date

//-->
</SCRIPT>

// Insert the following anywhere in the page as long as it comes after the script above.

<SCRIPT language="JavaScript">
<!--
// Writes English UK date format

document.write(dayName[now.getDay()] + ", " + now.getDate() + " " + monName[now.getMonth()] + " " + now.getFullYear());

//-->
</SCRIPT>