Days between

daysBetween

Overview

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

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

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com