USE DATE OBJECT METHODS
You can use these methods of the Date object to extract the date
and time information you wish to display. Start by creating a new
Date object and then use the Date object methods to
pull out the desired data, for example:
var myDate = new Date();
// creates a new instance of the Date object using the current time and date on the user's computer
alert ("The date is " + myDate.getMonth()
+ "-" + myDate.getDate() + "-"
+ myDate.getFullYear());
// writes the month, day of the month, and four-digit year to the page
as shown in Figure 5-3.
Figure 5-3: Displaying month, day, and year.
