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. 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 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()) { i++; 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
|