跳到主要内容

WEEKDAY

Returns a number from 1 to 7 identifying the day of the week of the specified date.

Syntax

expression.WEEKDAY(arg1, arg2);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberA number that represents a date, or a result of other formulas or functions.
arg2OptionalApiRange | ApiName | numberA number that determines the type of return value: -1 - returns a number from 1 (Sunday) to 7 (Saturday);\ -2 - returns a number from 1 (Monday) to 7 (Sunday); -3 - returns a number from 0 (Monday) to 6 (Sunday).

Returns

number

Example

const worksheet = Api.GetActiveSheet();

let func = Api.GetWorksheetFunction();
let ans = func.WEEKDAY("11/5/2018", 2);

worksheet.GetRange("C1").SetValue(ans);