| setTime() The setTime() method is used to set the number of milliseconds since January 1st, 1970 . The value of the Date object is in milliseconds, and specified within brackets, which may be referred to as the condition or argument of the method. The date object will then use this value for its operations. The date and time of your system clock is not consulted with this method. syntax: dateObjectName.setTime(milliseconds) EXAMPLE dateObject = new Date(); dateObject.setTime(3000); document.write("The date is: " + dateObject.getTime()); The example shows the creation of a new Date object, called dateObject. The setTime() method is then set to 3000. Then a document.write statement is declared with the getYear() method to display the new value of the dateObject after the string of text.. |