week function
The week function returns the week integer value of an attribute containing a value which can reconduct to a date.
Parameters
week(date, extract)
Parameter | Description |
---|---|
date | The date, week, month, quarter or datetime attribute type if the extract parameter is False to retrieve the month value. If the extract parameter is True, all attribute types can be used. The date parameter is mandatory. |
extract | A binary value (True/False) which is set as False as default. The binary parameter values (True/False) are case sensitive. |
Date type valid formats (if the values aren’t this format, the function will return an error).
2019/10/12;
12/10/2019;
2019-10-12;
12-10-2019;
2019/Oct/12;
12/Oct/2019;
2019-Oct-12;
12-Oct-2019.
Week type valid formats (if the values aren’t this format, the function will return an error).
2019/W41;
W41/2019;
2019-W41;
W41-2019.
Month type valid formats (if the values aren’t this format, the function will return an error).
1492/10;
10/1492;
1492-10;
10-1492;
1492/Oct;
1492-Oct;
Oct/1492;
Oct-1492.
Quarter type valid formats (if the values aren’t this format, the function will return an error).
2019/Q3;
Q3/2019;
2019-Q3;
Q3-2019.
Datetime type valid formats (if the values aren’t this format, the function will return an error).
2019/05/22 17:33:45
Example
The following example uses the Instagram_data dataset.
Description | Screenshot |
---|---|
In this example, we want to retrieve the week of the year where the pictures were posted. We add a new attribute, called week, and type the following formula:
and the attribute will be filled with the corresponding week in integer value. |