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

Get Day of Week Method


The Get Day of Week method returns the day of the week of a date object as a number from 0 through 6. Sunday is 0 and Saturday is 6.

Format

dateVar.getDay()

Example

To get the name of the corresponding weekday, you can create an array that contains the names of the days of the week, and then compare the return value to the array index. The following example gets the day of the week when New Year's Day occurs:

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 + ".");
}

This example displays the following text:

New Year's Day falls on Thursday in 2004.

Siebel eScript Language Reference Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices.