Export (0) Print
Expand All
2 out of 2 rated this helpful - Rate this topic

getDay Method (Date) (JavaScript)

Gets the day of the week, using local time.

dateObj. getDay() 

The required dateObj reference is a Date object.

An integer between 0 and 6 representing the day of the week (Sunday is 0, Saturday is 6).

To get the day using Universal Coordinated Time (UTC), use the getUTCDay method.

The following example shows how to use the getDay method.

var date = new Date("Saturday, February 9, 2008");
day = date.getDay();
document.write(day);

// Output: 6

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported in Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Applies To: Date Object (JavaScript)

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.