8 Javascript date get methods

In this blog post, we're taking a look at 8 javascript date get methods and break them down in a simple way.⁣ ⁣ The methods we will cover:⁣

  • Date.now()⁣
  • getFullYear()⁣
  • getMonth()⁣
  • getDay()⁣
  • getHours()⁣
  • getMinutes()⁣
  • getTime()⁣
  • getDate()⁣

Date Now - Date.now()⁣

Get the time using ECMAScript 5.


The static Date.now() method returns the number of UNIX milliseconds passed since January 1, 1970:00:00:00 UTC

Get Full Year - getFullYear()⁣

Get the year as a four-digit number(yyyy)

const year = new Date().getFullYear();

Get Month - getMonth()⁣

Get the month as a number (0-11)

const month = new Date().getMonth() + 1;

To get the correct month, you must add 1.

Get Day - getDay()⁣

Get the weekday as a number (0-6)

const day = new Date().getDay();
const days = [


Get Hours - getHours()⁣

Get the hour (0-23)

const hours = new Date().getHours();

Get Minutes - getMinutes()⁣

Get the minutes (0-59)

const minutes = new Date().getMinutes();

Get Time - getTime()⁣

Get the time in milliseconds since January 1, 1970

const time = new Date().getTime();

The internal clock in javascript counts from midnight January 1, 1970

Get Date - getDate()⁣

Get the day as a number (1-31)

const date = new Date().getDate();

The internal clock in javascript counts from midnight January 1, 1970


Do you use date methods?⁣ I hope this post helps you with the javascript date methods.

💌 If you'd like to receive more tutorials in your inbox, you can sign up for the newsletter here.


Up next