Siebel eScript Language Reference > Siebel eScript Commands > Date and Time Methods >

getDay() Method

This method returns the day of the week of a Date object.




The day of the week of dateVar as a number from 0 to 6.


This method returns the day of the week of dateVar. Sunday is 0, and Saturday is 6. To get the name of the corresponding weekday, create an array holding the names of the days of the week and compare the return value to the array index, as shown in the following example.


This example gets the day of the week on which New Year's Day occurs and displays the result in a message box.

function Button1_Click ()
   var weekDay = new Array("Sunday", "Monday", "Tuesday",
      "Wednesday", "Thursday", "Friday", "Saturday");
   var NewYearsDay = new Date("2004", "1", "1");
   var theYear = NewYearsDay.getFullYear()
   var i = 0;
   while (i < NewYearsDay.getDay())
      var result = weekDay[i];
   TheApplication().RaiseErrorText("New Year's Day falls on " + result + " in " + theYear + ".");

The result displayed in the message box is:

New Year's Day falls on Thursday in 2004.

See Also

getDate() Method
getFullYear() Method
getHours() Method
getMinutes() Method
getMonth() Method
getSeconds() Method
getTime() Method
getYear() Method

Siebel eScript Language Reference