The JavaScript date setFullYear() method sets the year value for the particular date on the basis of local time.
Syntax:
dateObj.setFullYear(new_year);
Parameters:
new_year: Integer value which represents a year.
Example:
<!DOCTYPE html> <html> <body> <script> var bday =new Date("March 13, 1987 21:00:10"); document.writeln(bday.getFullYear() + "<br>"); bday.setFullYear(1988); document.writeln(bday.getFullYear()); </script> </body> </html>