September 2003
Intermediate to advanced
944 pages
33h 46m
English
In Chapter 7, you learned how to use the time functions getTime() and setTime() to set and change the expiry date of a cookie. These two functions are designed to manipulate the time stores in a date object. The following is typical example code used to get the date and time of yesterday.
1: dateObj = new Date() 2: currentTime = dateObj.getTime() 3: yesterdayDate = currentDate – 1000*60*60*24
The first line is used to create a new object variable (or instance) named dateObj from the date object provided by the browser. Once we have done that, we can access all the methods of the object from the dateObj variable as demonstrated in line 2 (i.e., the getTime() ...
Read now
Unlock full access