How Get the Current Year in JavaScript

 

To get the current year, you can call the getFullYear() method, which returns the year of the given Date according to local time. The return value is an absolute number. For dates between 1000 and 9999 years, the getFullYear() method returns a four-digit number.

Create a new Date() object and call the getFullYear() method to return the current date

 

let date =  new Date().getFullYear();
console.log(date);

Tags:

Share:

Related posts