weekDay function
The weekDay function returns the day of the week as an integer for each value of date.
Parameters
weekDay(date, mondaystart)
Parameter | Description |
---|---|
date | The date, week, month, quarter or datetime attribute if the extract parameter is False to retrieve the weekday value. The date parameter is mandatory. |
mondaystart | A binary (True/False) set as True as default, controlling if the numeration of the days starts from Monday (True) or Sunday (False). 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 fill a new attribute with the weekday when the picture was posted. We add a new attribute, called weekday, and type the following formula:
and the attribute is filled with the corresponding integer value of the day of the week. As we didn’t specify the extract parameter, it is set as True, so the first day of the week is Monday. The results can be read as follows:
and so on. |