Returns the year (4 digits) of the specified date.
Syntax
date.getFullYear()Example
Enter values below to update the example in real time.
const→new→console→getFullYear→const date = new Date();
console.log(date.getFullYear()); // e.g. 2024