跳到主要内容

DAY

返回以数字格式给出的日期中的天数,从 1 到 31。

语法

expression.DAY(arg1);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number日期时间代码中的数字。

返回值

number

示例

从电子表格中的日期提取日期数字(1-31)。

// What day of the month does a date represent in a spreadsheet?

// Pull the day component from a date value in a spreadsheet.

const worksheet = Api.GetActiveSheet();

let func = Api.WorksheetFunction;
let ans = func.DAY("2018/3/16");

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