JavaScript Code


JavaScript – Get Full Year from Date


Date – getFullYear()

date.getFullYear()

getFullYear() returns the full year of this date object

Examples

1. get the full year for the current date

let date = new Date();
console.log(date);
console.log(date.getFullYear());


Copyright @2022