VOOZH about

URL: https://www.geeksforgeeks.org/javascript/javascript-date-getyear-method/

⇱ JavaScript Date getYear() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

JavaScript Date getYear() Method

Last Updated : 12 Jul, 2025

JavaScript date.getYear() is used to get the year on a specified date according to universal time. The year we get from the method getYear() is the current year minus 1900.

Syntax:

date.getYear();

Parameters:

  • This function does not accept any parameters.

Return Value:

  • This method returns a value that is subtracted from 1900 to the current year.

Example 1: This example returns the year of the specified date according to universal time.

Output:

The value returned by getYear() method: 119

Example 2: This example only sends the year to the constructor.

Output:

The value returned by getYear() method: 100

Example 3: Here, we pass a full date to the constructor, the format of the date is month-day-year-time, such as October 15, 2010, 02:05:32.


Output
The value returned by getYear() method: 110

Supported Browsers:

  • Google Chrome
  • Mozilla Firefox
  • Opera
  • Safari
Comment