<!-- JavaScript:Dates code snippet 5. -->
<!-- Formatting then writing the date using user defined arrays. -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- Code source: http://www.justfigures.co.uk/ -->
<!-- A resource for web developers using XHTML, CSS, JavaScript, PHP -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>View code snippet page</title>
<script language="JavaScript" type="text/javascript">
<!-- begin
function writeDate()
{
// create an array and fill with the days of the week
var dayName=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// create an array and fill with the months of the year
var monthName=new Array("Jan","Feb","Mar","April","May","June","July","Aug","Sept","Oct","Nov","Dec");
// create a Date object assign to it the current date
var now = new Date();
/* access the elements of the arrays and concatenate as one statement */
document.write(dayName[now.getDay()] + ", " + monthName[now.getMonth()] + " " + now.getDate() +", "+ now.getFullYear());
}
// end -->
</script>
</head>

<body>
<script language="JavaScript" type="text/javascript">
<!--
writeDate();
// -->
</script>
</body>
</html>