lastWeekOfMonth#

swordfish.function.lastWeekOfMonth()#

In the calendar month of X, suppose the last “weekday” is d.

  • If X <d: return the last “weekday” in the previous calendar month.

  • If X >=d: return the last “weekday” in the current calendar month.

If parameter offset is specified, the result is updated every n months. Parameter offset works only if parameter n >1.

Parameters:
  • X (Constant) – A scalar/vector of type DATE, DATETIME, TIMESTAMP or NANOTIMESTAMP.

  • weekday (Constant) – An integer from 0 to 6. 0 means Monday, 1 means Tuesday, …, and 6 means Sunday. The default value is 0.

  • offset (Constant) – A scalar of the same data type as X. It must be no greater than the minimum value of X. The default value is the minimum value of X.

  • n (Constant) – A positive integer. The default value is 1.