isWeek function in the Date and Time functions
The isWeek function checks whether the data type of the attribute specified in the string parameter is week.
Parameters Parameter Description string The nominal attribute to be tested. The string parameter is mandatory. binary If the optional binary parameter is True, or not specified, results will be provided as Booleans (True/False), while if it is False, results will be provided in binary form (1/0). The binary parameter values (True/False) are case sensitive. Week type valid formats (if the values aren’t this format, the function will return a False or 0). 2019/W41; W41/2019; 2019-W41; W41-2019isWeek(string, binary)
Example
The following example uses the Turkish Calendar dataset.
Description | Screenshot |
---|---|
In this example, we want to check if the WEEK_OF_YEAR attribute is a Week attribute. Change the WEEK_OF_YEAR attribute type to nominal, as the string parameter needs to be nominal. We add a new attribute, that we will call isweek, and write the following formula to fill it:
We wrote False as we want our results to be displayed in binary form. As the values of the WEEK_OF_YEAR attribute are not in the formats listed above, the function has returned only 0, which means false, setting the isweek attribute type as integer. |