JavaScript Get Date Methods JAVASCRIPT

JavaScript Get Date Methods  

JavaScript Get Date Methods

The getFullYear() Method

The getFullYear() method returns the year of a date as a four digit number:


var d = new Date();
document.getElementById("demo").innerHTML = d.getFullYear();

JavaScript Get Date Methods

These methods can be used for getting information from a date object:

Method Description
getFullYear() Get the year as a four digit number (yyyy)
getMonth() Get the month as a number (0-11)
getDate() Get the day as a number (1-31)
getHours() Get the hour (0-23)
getMinutes() Get the minute (0-59)
getSeconds() Get the second (0-59)
getMilliseconds() Get the millisecond (0-999)
getTime() Get the time (milliseconds since January 1, 1970)
getDay() Get the weekday as a number (0-6) Get the time. ECMAScript 5.

Download free E-book of JAVASCRIPT

Learn Programming for Free

Join Programmers Community on Telegram

Talk with Experienced Programmers

Just drop a message, we will solve your queries