Sets the full year for a specified date.
Syntax
date.setFullYear(year)Example
Enter values below to update the example in real time.
const→new→setFullYear→console→getFullYear→const date = new Date();
date.setFullYear(2025);
console.log(date.getFullYear()); // 2025