JavaScript Date getFullYear() method

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 which 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>

Output:

2018
Please Share