Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Date Object >
getDay() Method
This method returns the day of the week of a Date object.
Syntax
dateVar.getDay()
Returns
The day of the week of dateVar as a number from 0 to 6.
Usage
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.
Example
This example gets the day of the week on which Valentine's Day occurs and displays the result in a message box, shown in the illustration.
function Button1_Click ()
{
var weekDay = new Array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday");
var valentinesDay = new Date("2001", "1", "14");
var theYear = valentinesDay.getFullYear()
var i = 0;
while (i < valentinesDay.getDay())
{
i++;
var result = weekDay[i];
}
TheApplication().RaiseErrorText("Valentine's Day falls on " + result + " in " + theYear + ".");
}See Also
GetDate() Method, getFullYear() Method, getHours() Method, getMinutes() Method, getMonth() Method, getSeconds() Method, getTime() Method, and getYear() Method
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |