getFullYear()  Date  instance method JS Home  <<  JS Reference  <<  Date  <<  getFullYear()

Description

Returns the locale specific year (CCYY) for the specified date.

Syntax

Signature Description
aDate.getFullYear()Returns the locale specific year (CCYY) for the specified date.

Parameters

None.

Examples

The code below shows an example of the getFullYear() method of Date.



// Create a Date instance for the current date and time.
var todaysDate = new Date();
alert(todaysDate);

// Get Year.
alert(todaysDate.getFullYear() + ' = full year');

Press the button below to action the above code:

Related Tutorials

JavaScript Intermediate Tutorials - Lesson 2 - Dates and Times