Learn JavaScript
Date
29.3
Lesson

Date getter methods

The Date object has a number of methods to get the value of its properties.

The myDate.now() method returns the number of milliseconds between January 1, 1970 and the current date.

The getFullYear() method returns the year as a four-digit number.

The getMonth() method returns the month as a number between 0 and 11. Here, 0 stands for January and 11 stands for December.

The getDate() method returns the day as a number between 1 and 31.

The getHours() method returns the hour as a number between 0 and 23.

The getMinutes() method returns the minutes as a number between 0 and 59.

The getSeconds() method returns the seconds as a number between 0 and 59.

The getMilliseconds() method returns the milliseconds as a number between 0 and 999.

The getTime() method returns the number of milliseconds between January 1, 1970 UTC and the current date.