Create a new Date() object and call getFullYear():

new Date().getFullYear()  // returns the current year

Example usage: a page footer that always shows the current year:

document.getElementById("year").innerHTML = new Date().getFullYear();
footer {
  text-align: center;
  font-family: sans-serif;
}
<footer>
     <span id="year"></span> by Stack Overflow
</footer>

See also, the Date() constructor's full list of methods.

Answer from Jason Harwig on Stack Overflow
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getYear
Date.prototype.getYear() - JavaScript | MDN
The getYear() method of Date instances returns the year for this date according to local time. Because getYear() does not return full years ("year 2000 problem"), it is deprecated and has been replaced by the getFullYear() method.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getFullYear
Date.prototype.getFullYear() - JavaScript | MDN
const moonLanding = new Date("July 20, 69 00:20:18"); console.log(moonLanding.getFullYear()); // Expected output: 1969 ... An integer representing the year for the given date according to local time.
🌐
W3Schools
w3schools.com › jsref › jsref_getfullyear.asp
JavaScript Date getFullYear() Method
❮ Previous JavaScript Date Reference Next ❯ · Get the year: const d = new Date(); let year = d.getFullYear(); Try it Yourself » · Get the year of a specific date: const d = new Date("July 21, 1983 01:15:00"); let year = d.getFullYear(); ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › javascript-date-getyear-method
JavaScript Date getYear() Method - GeeksforGeeks
July 12, 2025 - JavaScript · // "date" is object of Date() class let date = new Date(); // Use "getYear()" method and stores // the returned value to "n" let n = date.getYear(); // Display the result console.log("The value returned by getYear() method: " + ...
🌐
CoreUI
coreui.io › answers › how-to-get-the-current-year-in-javascript
How to get the current year in JavaScript · CoreUI
October 2, 2025 - From my expertise, the most reliable and precise solution is to use the getFullYear() method on a Date object. This approach returns the complete 4-digit year and automatically updates as time progresses, making it perfect for dynamic content.
🌐
W3docs
w3docs.com › javascript
How Get the Current Year in JavaScript
Javascript create new date and invoke getFullYear() method · //Date().getFullYear() let date = new Date().getFullYear(); console.log(date); Run > Reset · It is important to use getFullYear(), not getYear(), as it is deprecated and can return ...
🌐
DEV Community
dev.to › theudemezue › how-to-get-current-year-in-javascript-49f2
How To Get Current Year In JavaScript - DEV Community
March 8, 2025 - Yes, the Date object and its methods like getFullYear() have been part of JavaScript for a long time and are supported by all modern browsers. I usually create a function that retrieves the year once and then updates all the elements that need the current year.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › now
Date.now() - JavaScript | MDN
The Date.now() static method returns the number of milliseconds elapsed since the epoch, which is defined as the midnight at the beginning of January 1, 1970, UTC.
Find elsewhere
🌐
TutorialsPoint
tutorialspoint.com › home › javascript › javascript date getfullyear method
JavaScript Date getFullYear Method
September 1, 2008 - Javascript date getYear() method returns the year in the specified date according to universal time.
🌐
W3Schools
w3schools.com › js › js_date_methods.asp
JavaScript Get Date Methods
In JavaScript, date objects are created with new Date(). new Date() returns a date object with the current date and time. ... The get methods above return Local time.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getUTCFullYear
Date.prototype.getUTCFullYear() - JavaScript | MDN
const date1 = new Date("December 31, 1975, 23:15:30 GMT+11:00"); const date2 = new Date("December 31, 1975, 23:15:30 GMT-11:00"); console.log(date1.getUTCFullYear()); // Expected output: 1975 console.log(date2.getUTCFullYear()); // Expected output: 1976 ... An integer representing the year ...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-current-year
How to get the Current Year in JavaScript [for copyright] | bobbyhadz
Call the getFullYear() method on the Date object. The getFullYear method will return the current year.
🌐
Medium
frontendinterviewquestions.medium.com › how-to-get-current-year-in-javascript-4400b75a827e
How to get current year in JavaScript ? | by Pravin M | Medium
September 7, 2024 - For more questions and answers visit our website at Frontend Interview Questions · JavaScript’s built-in Date object allows you to work with dates and times. To get the current year, you use the Date constructor and call its method getFullYear(), ...
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › setFullYear
Date.prototype.setFullYear() - JavaScript | MDN
The setFullYear() method of Date instances changes the year, month, and/or day of month for this date according to local time. const event = new Date("August 19, 1975 23:15:30"); event.setFullYear(1969); console.log(event.getFullYear()); // Expected output: 1969 event.setFullYear(0); ...
🌐
Altcademy
altcademy.com › blog › how-to-get-current-year-in-javascript
How to get current year in JavaScript
June 9, 2023 - In this tutorial, we've learned how to get the current year in JavaScript using the Date object and the getFullYear() method. We also saw how to use this information to display the current year on a web page.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › Date
Date() constructor - JavaScript | MDN
new Date() new Date(value) new Date(dateString) new Date(dateObject) new Date(year, monthIndex) new Date(year, monthIndex, day) new Date(year, monthIndex, day, hours) new Date(year, monthIndex, day, hours, minutes) new Date(year, monthIndex, day, hours, minutes, seconds) new Date(year, monthIndex, day, hours, minutes, seconds, milliseconds) Date() Note: Date() can be called with or without new, but with different effects. See Return value. There are five basic forms for the Date() constructor: When no parameters are provided, the newly-created Date object represents the current date and time as of the time of instantiation. The returned date's timestamp is the same as the number returned by Date.now().
🌐
Squash
squash.io › how-to-get-the-current-year-in-javascript
How to Get the Current Year in Javascript
Below are two possible approaches to retrieve the current year: The Date object in JavaScript has a method called getFullYear that returns the current year as a four-digit number.