Home » JavaScript Date getDay() Method

JavaScript Date getDay() Method

by Online Tutorials Library

JavaScript Date getDay() method

The JavaScript date getDay() method returns the value of day of the week for the specified date on the basis of local time. The value of the day starts with 0 that represents Sunday.

Syntax

The getDay() method is represented by the following syntax:

Return

An integer value between 0 and 6 that represents the days of the week for the specified date.

JavaScript Date getDay() method example

Here, we will understand getDay() method through various examples.

Example 1

Let’s see an example to print the value of today’s weekday.

Test it Now

Output:

1  

Example 2

Let’s see an example to print the value of weekday from the given date.

Test it Now

Output:

5  

Next TopicJavaScript Math

You may also like