aqDateTime.GetDayOfWeek Method

Applies to TestComplete 14.72, last modified on December 24, 2020

Description

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

Declaration

aqDateTime.GetDayOfWeek(InputDate)

InputDate [in]    Required    Date/Time    
Result Integer

Applies To

The method is applied to the following object:

Parameters

The method has the following parameter:

InputDate

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.

Remarks

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;
  ReturnDate=aqDateTime.GetDayOfWeek(InputDate)-1;
  if (ReturnDate==0) ReturnDate=7;
  return ReturnDate;
}

Python

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

VBScript

Function ISODayOfWeek(InputDate)
  ISODayOfWeek=aqDateTime.GetDayOfWeek(InputDate)-1
  If (ISODayOfWeek=0) Then ISODayOfWeek=7
End Function

DelphiScript

function ISODayOfWeek(InputDate: TDateTime );
begin
  Result:=aqDateTime.GetDayOfWeek(InputDate)-1;
  if (Result=0) then Result:=7;
end;

C++Script, C#Script

function ISODayOfWeek(InputDate)
{
var ReturnDate;
  ReturnDate=aqDateTime["GetDayOfWeek"](InputDate)-1;
  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