isodayofwk(X)

Returns the ISO-8601 day of the week for a given date or timestamp. (Available as of version 16.04)

Syntax

isodayofwk(X)

Input

Argument Type Description
X integer or decimal A scalar value or the name of a column containing date-related values
Valid values can be of the form:
  • date
  • month
  • quarter
  • date+time

For more information, see Dates and time .

Return Value

Returns the integer value (e.g., 1=Monday, 2=Tuesday ... 7=Sunday) corresponding to the day of the week based on the input.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

Applying this function to a date column in a table will calculate the day of week for each row:

<base table="retaildemo.retail.sales_detail"/>
<willbe name="isodayofwk" value="isodayofwk(date)"/>
<colord cols="date,isodayofwk"/>

Example

Applying this function to a scalar value which represents a date will simply return the day of the week for that date.

<base table="retaildemo.retail.sales_detail"/>
<willbe name="isodayofwk" value="isodayofwk(20120531)"/>
<colord cols="isodayofwk"/>