WEEKNUM
Returns the week number in the year.
Syntax
expression.WEEKNUM(arg1, arg2);
expression
- A variable that represents a ApiWorksheetFunction class.
Parameters
Name | Required/Optional | Data type | Default | Description |
---|---|---|---|---|
arg1 | Required | ApiRange | ApiName | number | The date-time code used for date and time calculation. | |
arg2 | Optional | ApiRange | ApiName | number | A number (1 or 2) that determines the type of the return value: Sunday (1) or Monday (2). |
Returns
number
Example
- Code
- Result
const worksheet = Api.GetActiveSheet();
let func = Api.GetWorksheetFunction();
let ans = func.WEEKNUM("11/5/2018", 2);
worksheet.GetRange("C1").SetValue(ans);