getFullYear()
ES1+Returns the year of the specified date according to local time.
Syntax
date.getFullYear()Return Value
number
A number representing the year
Examples
JavaScript
const date = new Date('2024-01-15');
console.log(date.getFullYear()); Output:
// 2024