weekEnd#
- swordfish.function.weekEnd()#
For each element of X, return the last date of the week that it belongs to and that ends on the day as specified by parameter weekday.
If parameter weekday>=weekday(X, false): for each element of X, return a date that corresponds to the specified “weekday” parameter in the same calendar week.
If parameter weekday<weekday(X, false): for each element of X, return a date that corresponds to the specified “weekday” parameter in the next calendar week.
If parameter offset is specified, the result is updated every n weeks. The parameters offset and n must be specified together, and offset takes effect only when n > 1.
- Parameters:
X (Constant) – A scalar/vector of type DATE, DATETIME, DATEHOUR, TIMESTAMP or NANOTIMESTAMP.
weekday (Constant, optional) – An integer from 0 to 6. 0 means Monday, 1 means Tuesday, …, and 6 means Sunday, by default DFLT.
offset (Constant, optional) – A scalar of the same data type as X. It must be no greater than the minimum value of X, by default DFLT.
n (Constant, optional) – A positive integer, by default DFLT.