Skip to main content

DAYS

Returns the number of days between the two dates.

Syntax

expression.DAYS(arg1, arg2);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters

NameRequired/OptionalData typeDefaultDescription
arg1RequiredApiRange | ApiName | numberStart date from which days will be counted.
arg2RequiredApiRange | ApiName | numberEnd date until which days will be counted.

Returns

number

Example

This example shows how to return the number of days between the two dates.

// How to get difference between two dates in days.

// Use function to get days count between two dates.

const worksheet = Api.GetActiveSheet();

let func = Api.GetWorksheetFunction();
let ans = func.DAYS("3/31/2018", "3/16/2018");

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