(IWOY(arg1)) or (IWOY(arg1,arg2))
Returns the week number of the year for the specified date. The use of arg2 is optional, to indicate different week counting methods.
Syntax:
(IWOY(date,parameter))
Where:
date is a valid DATE data type value
parameter specifies week counting method
Parameters:
Parameter |
Description |
1 |
Specifies that weeks start on Sunday, and January 1 is in the first week of the year |
2 |
Specifies that weeks start on Monday, and January 1 is in the first week of the year |
21 |
Specifies that weeks follow the ISO 8601 standard, which means that week 1 for the year is the first week with 4 or more days of January in it. In addition, the week starts on Monday. |
Remarks:
•The first parameter must be a valid DATE value.
•The IWOY function with no second parameter is identical to using the 1 parameter.
Examples:
01.
In the following example, the value of viwoy_1 is 12.
SET VAR viwoy_1 = (IWOY('03/15/2016'))
02.
In the following example, the value of viwoy_2 is 11.
SET VAR viwoy_2 = (IWOY('03/15/2016',21))
03.
In the following example, the value of viwoy_3 is 39.
SET VAR vDate DATE = 09/19/2016
SET VAR viwoy_3 = (IWOY(.vDate,2))
04.
In the following example, the value of viwoy_4 is 38.
SET VAR vDate DATE = 09/19/2016
SET VAR viwoy_4 = (IWOY(.vDate,21))