Javatpoint Logo
Javatpoint Logo

JavaScript Date getFullYear() method

The JavaScript date getFullYear() method returns the year for the specified date on the basis of local time.

Syntax

The getFullYear() method is represented by the following syntax:

Return

A number the represents year.

JavaScript Date getFullYear() method example

Here, we will understand getFullYear() method through various examples.

Example 1

Let's see an example to print the value of current year.

Test it Now

Output:

2018

Example 2

Let's see an example to print the year from the given date.

Test it Now

Output:

1947

Next TopicJavaScript Math




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA