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
🌐
W3Schools
w3schools.com › jsref › jsref_getfullyear.asp
JavaScript Date getFullYear() Method
cssText getPropertyPriority() getPropertyValue() item() length parentRule removeProperty() setProperty() JS Conversion ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
W3docs
w3docs.com › javascript
How Get the Current Year in JavaScript
For the dates between 1000 and 9999 years, the getFullYear() method returns a four-digit number. Create a new Date() object and invoke getFullYear() method to return the current date: Javascript create new date and invoke getFullYear() method
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getFullYear
Date.prototype.getFullYear() - JavaScript - MDN Web Docs
July 10, 2025 - 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.
🌐
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 - W3Schools JavaScript Date Reference - A beginner-friendly reference that includes examples and simple explanations of how to work with dates in JavaScript. Stack Overflow - For real-world problems and solutions, I often browse through questions on Stack Overflow. It’s a valuable community resource when I run into issues or need alternative approaches. Learning to get the current year ...
🌐
W3Schools
w3schools.com › js › js_date_methods.asp
JavaScript Get Date Methods
The getFullYear() method returns the year of a date as a four digit number: const d = new Date("2021-03-25"); d.getFullYear(); Try it Yourself » · const d = new Date(); d.getFullYear(); Try it Yourself » · Old JavaScript code might use the ...
🌐
Bobby Hadz
bobbyhadz.com › blog › javascript-get-current-year
How to get the Current Year in JavaScript [for copyright] | bobbyhadz
To get the current year, use the `new Date()` constructor to get a `Date` object. Call the `getFullYear()` method on the `Date` object.
🌐
Scaler
scaler.com › home › topics › get current year in javascript
Get the Current Year in JavaScript - Scaler Topics
May 4, 2023 - The returned year is in the format of a four-digit number. In this article, we will discuss all the topics related to this method with examples and explanations where ever necessary. A Date is a built-in object present in JavaScript that is used to handle the operations related to the date and time. We can use make use of the Date object for displaying the date and time that corresponds to the current date and local time of that particular user zone.
Find elsewhere
🌐
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 - 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(), which retrieves the year as a four-digit number (e.g., 2024).
🌐
Altcademy
altcademy.com › blog › how-to-get-current-year-in-javascript
How to get current year in JavaScript - Altcademy.com
June 9, 2023 - In this example, we first created a Date object representing the current date and time, and then we called the getFullYear() method on it to get the current year. Finally, we used the console.log() function to print the current year to the browser's ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-get-the-current-year-using-javascript
How to get the current year using JavaScript ? - GeeksforGeeks
July 15, 2025 - In this article, we will know how to get the current year using the build-in method in Javascript. The purpose is to get the current year by using JavaScript getFullYear() method that will return the full year in 4-digit format for some specified ...
🌐
W3Schools
w3schools.sinsixx.com › jsref › jsref_getyear.asp.htm
JavaScript getYear() Method - SinSiXX - W3Schools
Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › Date › getYear
Date.prototype.getYear() - JavaScript - MDN Web Docs
July 10, 2025 - 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.
🌐
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.
🌐
W3Schools
w3schools.com › js › js_dates.asp
JavaScript Dates
February 4, 2026 - Date methods allow you to get and ... covered in the next chapters. JavaScript will (by default) output dates using the toString() method....
🌐
TutorialsPoint
tutorialspoint.com › javascript › date_getyear.htm
JavaScript Date getYear() Method
Returns the year in the specified date according to universal time. Try the following example. <html> <head> <title>JavaScript getYear Method</title> </head> <body> <script type = "text/javascript"> var dt = new Date(); document.write("getYear() : " + dt.getYear() ); </script> </body> </html>
🌐
Technogeeks CS
technogeekscs.com › home › how to get current year in javascript
How to get Current Year in JavaScript
April 9, 2025 - In the given example, we will be using the current year method in the html page. This html page will help us to get the year by using the getFullYear method. Here we had used H1 and H2 Tags for displaying the title.
Call   8600998107
Address   3rd Floor, Plot No 7, Common Wealth Society , Opposite Aundh Telephone Exchange, Landmark : Gaikward Petrol Pump Aundh,, 411007, Pune
🌐
SheCodes
shecodes.io › athena › 56873-how-to-log-the-current-year-in-javascript
[JavaScript] - How to log the current year in JavaScript - | SheCodes
Learn how to use the Date() object and getFullYear() method in JavaScript to log the current year to the console.
🌐
Squash
squash.io › how-to-get-the-current-year-in-javascript
How to Get the Current Year in Javascript - Squash Labs
April 29, 2024 - 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.