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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA