How to get the current year using JavaScript ? Last Updated : 11 Nov, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 date. This method is used to fetch the year from a given Date object. Syntax: DateObject.getFullYear(); Parameter: This function does not accept any parameters. Return Values: It returns the year for the given date. Example: This example describes getting the current year. Generally, it is used to validate the input year in the 4-digit format on the website. HTML <!DOCTYPE html> <html> <body style="text-align:center;"> <h1>GeeksforGeeks</h1> <h2> How to get the current year in JavaScript? </h2> <button onclick="geeks()"> click me </button> <h4 id="myID"></h4> <script> function geeks() { // Creating Date Object var dateobj = new Date(); // Year from above object // is being fetched using getFullYear() var dateObject = dateobj.getFullYear(); // Printing current year document.getElementById("myID").innerHTML = "The Current Year is : " + dateObject; } </script> </body> </html> Output: getting the current year Comment More infoAdvertise with us Next Article How to get the first day of the year in JavaScript ? M manaschhabra2 Follow Improve Article Tags : JavaScript JavaScript-Questions Similar Reads How to Get the Current Date in JavaScript ? The Date() object is used to access the current date in JavaScript. To get the current date in string format, we can use toDateString() method. The date.toDateString() method converts the given date object into the date portion into a string.SyntaxdateObj.toDateString()JavaScript// Create a Date Obj 2 min read How to get the day and month of a year using JavaScript ? Given a date and the task is to get the day and month of a year using JavaScript. Approach: First get the current date by using new Date().Use getDay() method to get the current day in number format, Map it to the day name.Use getMonth() to get the current month in number format, Map it to the month 2 min read How to Get Last Week's Date using JavaScript ? In this article, we are going to learn about how to get last week's Date by using JavaScriptthe. JavaScript's dynamic nature improves websites by adding dynamic elements. Fetching the previous week's date is vital for event schedules, calendars, and timely data display. There are several methods tha 4 min read How to Log the Current Date in JavaScript ? The Date object is an inbuilt object constructor of JavaScript language. It is used to work with dates and times. The Date object is created by using the new keyword, i.e. new Date(). The current date can be logged on the console in JavaScript using the below-discussed methods. Table of Content Usin 3 min read How to get the first day of the year in JavaScript ? Given a date/year and the task is to get the first day of the year using JavaScript. Approach 1: Use getFullYear() Method to get the year from the given date.Use the new Date() function to create the new date object using year, month, and day. Example: This example uses the getFullYear() method to g 1 min read How to get the first and last date of current month using JavaScript ? Given a month and the task is to determine the first and last day of that month in proper format using JavaScript. JavaScript getDate() Method: This method returns the day of the month (from 1 to 31) for the defined date. Syntax: Date.getDate() Parameters: This method does not accept any parameters. 3 min read Like