| getFullYear() The getFullYear() method is used to return the four digits representing the year, which is the taken from the date specified by your operating system, and used by the Date object. syntax: dateName.getFullYear() EXAMPLE dateObject = new Date(); document.write("The date is: " + dateObject.getFullYear()); The example shows the creation of a new Date object, called dateObject. It is then used within a document.write statement, with the getFullYear() method to display the current date after the string of text. |