Share via


getDay Method

Returns the day of the week value in a Date object using local time.

function getDay() : Number

Remarks

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

The value returned from the getDay method is an integer between 0 and 6 representing the day of the week and corresponds to a day of the week as follows:

Value

Day of the Week

0

Sunday

1

Monday

2

Tuesday

3

Wednesday

4

Thursday

5

Friday

6

Saturday

The following example illustrates the use of the getDay method.

function DateDemo(){
   var d, day, x, s = "Today is: ";
   var x = new Array("Sunday", "Monday", "Tuesday");
   var x = x.concat("Wednesday","Thursday", "Friday");
   var x = x.concat("Saturday");
   d = new Date();
   day = d.getDay();
   return(s += x[day]);
}

Requirements

Version 1

Applies To:

Date Object

See Also

Reference

getUTCDay Method