now = new Date(); // create an object representing the current date and time xmas = new Date(96, 11, 25); // Create a Date object representing Christmas
Methods of the Date object allow you to get and set the various date and time values, and to convert the Date to a string, using either local time or GMT time. For example:
xmas.setYear(xmas.getYear() + 1); // Change the date to next Christmas document.write("Today is: " + now.toLocaleString());
You can find full documentation on the Date object and its methods in the reference section of this book. Unfortunately, the Date object is plagued with various bugs in Navigator 2.0. Appendix B, Known Bugs, contains details.