.getFullYear()
StevenSwiniarski474 total contributions
Published May 31, 2023Updated Jun 1, 2023
Contribute to Docs
The .getFullYear()
method returns a four digit year for the date according to local time.
Syntax
myDate.getFullYear();
The returned value of the .getFullYear()
method is an integer representing the year for the provided date myDate
.
Codebyte Example
In the example below, the year
variable stores the year returned from a new Date object and then logs it to the console.
All contributors
- StevenSwiniarski474 total contributions
- cguttweb7 total contributions
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.