Dynamic Date Display

Submitted by:David Villa

Date added:19 October, 2011

Category:JavaScript

An example to display Dynamic Date

Tags: dynamic date

Code Snippet:

<SCRIPT>
var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
var monthName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var now = new Date();
</SCRIPT>
<BODY>
<SCRIPT>
/ getDay() -- day of the week (a number between 0 - 6)
// getMonth() -- month of the year (a number between 0 - 11)
// getDate() -- day of the month (a number between 1 - 31)
document.write("<H1>Today is " +
dayName[now.getDay()] + ", " +
monthName[now.getMonth()] + " " +
now.getDate() + ".</H1>")
</SCRIPT>
 
 

Comments