aqDateTime.GetDayOfWeek Method

Applies to TestComplete 15.65, last modified on July 17, 2024


Use the aqDateTime.GetDayOfWeek method to get the number of a week day.



InputDate [in]    Required    Date/Time    
Result Integer

Applies To

The method is applied to the following object:


The method has the following parameter:


Specifies the date for which you are going to get the day of the week.

Result Value

An integer number ranging from 1 to 7. 1 corresponds to Sunday, 7 - to Saturday.


The GetDayOfWeek method uses the United States system of week notation where a week starts on Sunday and ends on Saturday. However, the ISO 8601 “Data elements and interchange formats - Information interchange - Representation of dates and times” standard recommends another system of week notation. In this system, a week starts on Monday and ends on Sunday. To convert a US week day number to the ISO 8601 format, you can use the following routine:

JavaScript, JScript

function ISODayOfWeek(InputDate)
var ReturnDate;
  if (ReturnDate==0) ReturnDate=7;
  return ReturnDate;


def ISODayOfWeek(InputDate):
  ReturnDate = aqDateTime.GetDayOfWeek(InputDate)-1
  if ReturnDate == 0:
    ReturnDate = 7
  return ReturnDate


Function ISODayOfWeek(InputDate)
  If (ISODayOfWeek=0) Then ISODayOfWeek=7
End Function


function ISODayOfWeek(InputDate: TDateTime );
  if (Result=0) then Result:=7;

C++Script, C#Script

function ISODayOfWeek(InputDate)
var ReturnDate;
  if (ReturnDate==0) ReturnDate=7;
  return ReturnDate;

The result of this function is also an integer number, but 1 corresponds to Monday, 2 - to Tuesday and so on.

See Also

Working With Dates
Working With Time
GetDayOfYear Method
GetDay Method
GetMonth Method
GetYear Method
GetHours Method
GetMinutes Method
GetSeconds Method

Highlight search results