Date is a built-in object to handle all the date-time related operations. We can get the current year using the
getFullYear() method attached to it.
getFullYear() method returns the year of the current date according to local time. It returns a four-digit number between 1000 and 9999. It returns an absolute number.
var currentTime = new Date(); var year = currentTime.getFullYear() console.log(year);