JavaScript Date getFullYear() method returns the “year for this date according to local time.” The getFullYear() method returns an absolute number.
Syntax
Date.getFullYear()
Parameters
It does not take any parameters.
Return value
It is an integer representing the year for the given date according to local time. Returns NaN if the date is invalid.
Example 1: How to Use Date getFullYear() Method
let dtObj = new Date('September , 1993 16:30:32');
let data = dtObj.getFullYear();
console.log(data);
Output
1993
Example 2: Passing no parameter
let dtObj = new Date();
let data = dtObj.getFullYear();
console.log(data);
Output
2023
Example 3: Date getFullYear() returns NaN
let dtObj = new Date('September 32, 1993 05:35:32');
let data = dtObj.getFullYear();
console.log(data);
Output
NaN
Browser Compatibility
Chrome | Edge | Firefox | Safari | Opera | IE |
Yes | Yes | Yes | Yes | Yes | Yes |
That’s it!
Related posts

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.