Choose where you’d like to start

daysBetween

Table of Contents

Overview

The daysBetween function takes startDateValue and endDateValue as arguments and returns the number of days between them.

Note: The days360() function can also be used as an alternative to perform the same operation since they behave in the same way.

Return Type

  • Number

Syntax

<variable> = <startDateValue>.daysBetween( <endDateValue>);

(OR)

<variable> = daysBetween(<startDateValue>,<endDateValue>);
ParameterData typeDescription
<variable>NUMBERVariable which will contain the number of days between the given start and end dates.
<startDateValue>DATE-TIME

The starting date.

<endDateValue>DATE-TIME

The ending date.

A runtime error will be encountered if:

 

  • the hour value, or minute value, or second value, is specified in more than 2 digits
  • the date value exceeds the number of days in that month.
  • an incorrect month value is specified.
  • the year value has more than 4 digits.
  • Please refer this help document to learn about the supported date-time formats.

Examples

startDate = '1-Jan-2019'; 
endDate = '31-Dec-2019'; 
numberOfDays = daysBetween(startDate, endDate); // returns 364 
newStartDate = '1-Jan-2020'; 
newEndDate = '31-Dec-2020'; 
numOfDays = daysBetween(newStartDate, newEndDate); // returns 365         

Get Started Now

Execute