Author: Ronald S. Holland
Total Application Works
© 2002 - 2011 All Rights Reserved Total Application Works
How do you create the Date object?
You can create a Date object by doing the following:
In the Figure 1 table above, myDate is the Date object. The Date object evaluates to an object rather than to some string or numeric value. Another point to remember is that var myDate is a reference to where the Date object resides. Your street address is a reference to where you reside. Your street address does not contain your possessions; it is a reference to where to find your possessions. What does this really mean? The street address is a reference. Your apartment or house can be thought of as a container. In the next section, we will explore the methods found on the Date class.
You should note that some values begin counting with 0 and others begin with 1. For example, January is month 0; December is month 11. Hours, minutes, and seconds all begin with 0. In the next section, we will explore how the Date methods are invoked.
How would set the year using the Date object?
After pressing the value of myDate.getYear() button in Figure 6, the following will be displayed.
© 2002 - 2010 All Rights Reserved Total Application Works