HTML and CSS Reference
In-Depth Information
Figure 9.20 The computer's date and time settings.
If no arguments are passed to the Date object constructor, it returns the local date and
time (based on the accuracy of the clock on your client machine). There are five formats
that can be passed as arguments when creating a Date object; shown in Example 9.16.
EXAMPLE 9.16
new Date("Month dd, yyyy hh:mm:ss")
new Date("Month dd, yyyy")
new Date(yy,mm,dd,hh,mm,ss)
new Date(yy,mm,dd)
new Date(milliseconds)
Here are a few examples of instantiating a date:
mydate = new Date()
mydate = new Date("March 15, 2010 09:25:00")
mydate = new Date(“March 15, 2010”)
mydate = new Date(10,2,15)
mydate = new Date(10,2,15,9,25,0)
mydate = new Date(500);
9.4.1 Using the Date Object Methods
The Date object comes with a large number of methods (see Table 9.3) and only a
prototype
property.
For
browser
versions
supporting
Date
methods,
see
http://www.w3schools.com/js/js_datetime.asp .
 
 
Search WWH ::




Custom Search