JavaScript Date getFullYear()

The JavaScript date getFullYear() method is used to return the integer value that represents the year based on the local time.

Syntax:

dateObj.getFullYear()

Return:
An integer value that represents a year.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var bday = new Date("March 16, 2018 21:00:10");
document.writeln(bday.getFullYear())
</script>
</body>
</html>