English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript getFullYear() Method

 JavaScript Date Object

getFullYear()The method returns the year of the specified date object based on local time (returns four digits for four-digit years).

getFullYear()The returned value is an absolute number.

For dates between1000 and9999dates between the yearsgetFullYear()Returns a four-digit number, such as1992.

Syntax:

date.getFullYear()
var d = new Date();
d.getFullYear();
Test and see‹/›

Browser Compatibility

All browsers fully support the getFullYear() method:

Method
getFullYear()YesYesYesYesYes

Technical Details

Return Value:A number representing the year
JavaScript Version:ECMAScript 1

More Examples

Return the year of a specific date:

var d = new Date('August 20, 1999 23:15:30');
d.getFullYear();
Test and see‹/›

 JavaScript Date Object