跳到主要内容

EOMONTH

返回指定月数之前或之后月份最后一天的序列号。

语法

expression.EOMONTH(arg1, arg2);

expression - 表示 ApiWorksheetFunction 类的变量。

参数

名称必需/可选数据类型默认值描述
arg1必需ApiRange | ApiName | number表示开始日期的序列日期数字。
arg2必需ApiRange | ApiName | number开始日期之前或之后的月数。

返回值

number

示例

此示例演示如何返回指定月数之前或之后某月最后一天的序列号。

// How to get a date of the last day of the month before or after specified months.

// Use function to get the serial number of the last day of the month before or after the specified number of months.

const worksheet = Api.GetActiveSheet();

let func = Api.WorksheetFunction;
let ans = func.EOMONTH("3/16/2018", 10);

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