74
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.
Output:
2018
Example 2
Let’s see an example to print the year from the given date.
Output:
1947
Next TopicJavaScript Math