English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript getDay() method

 JavaScript Date Object

getDay()Returns the day of the week in the month for the specified date object based on local time (0-6)

getDay()The returned value is an integer corresponding to the day of the week: 0 represents Sunday,1Represents Monday, and so on.

Please refer to a specific day of the month.getDate()method.

Syntax:

date.getDay()
var d = new Date();
d.getDay();
Test and see‹/›

Browser Compatibility

The getDay() method is fully supported by all browsers:

Method
getDay()isisisisis

Technical Details

Return value:0 to6are integers between
JavaScript Version:ECMAScript 1

More Examples

Returns the day of the week for a specified date:

var d = new Date(#39;August 20, 1999 23:15:3039;);
d.getDay();
Test and see‹/›

The Today variable saves the name of the date:

var arr = [39;Sun39;,39;Mon39;,39;Tue39;,39;Wed39;,39;Thu39;,39;Fri39;,39;Sat39;];
var d = new Date();
var today = arr[d.getDay()];
Test and see‹/›

 JavaScript Date Object