Description
Use the aqDateTime.GetDayOfWeek
method to get the number of a week day.
Declaration
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
{
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
ISODayOfWeek=aqDateTime.GetDayOfWeek(InputDate)-1
If (ISODayOfWeek=0) Then ISODayOfWeek=7
End Function
DelphiScript
begin
Result:=aqDateTime.GetDayOfWeek(InputDate)-1;
if (Result=0) then Result:=7;
end;
C++Script, C#Script
{
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
aqDateTime.GetDayOfYear Method
aqDateTime.GetDay Method
aqDateTime.GetMonth Method
aqDateTime.GetYear Method
aqDateTime.GetHours Method
aqDateTime.GetMinutes Method
aqDateTime.GetSeconds Method