EDATE
Returns the serial number of the date which comes the indicated number of months before or after the start date.
Syntax
expression.EDATE(arg1, arg2);
expression - A variable that represents a ApiWorksheetFunction class.
Parameters
| Name | Required/Optional | Data type | Default | Description |
|---|---|---|---|---|
| arg1 | Required | ApiRange | ApiName | number | A serial date number that represents the start date. | |
| arg2 | Required | ApiRange | ApiName | number | The number of months before or after the start date. |
Returns
number
Example
This example shows how to return the serial number of the date which comes the indicated number of months before or after the start date.
- Code
- Result
// How to get a date some months before or after the start date.
// Use function to get the serial number of the date indicated number of months before or after the start date.
const worksheet = Api.GetActiveSheet();
let func = Api.WorksheetFunction;
let ans = func.EDATE("3/16/2018", 7);
worksheet.GetRange("C1").SetValue(ans);