Newer Version Available

This content describes an older version of this product. View Latest

daysBetween()

Returns the number of days between two dates. This function is only valid in a foreach statement.

Syntax

daysBetween(date1, date2)

date1 specifies the start date.

date2 specifies the end date.

Usage

If date1 is after date2, the number of days returned is a negative number.

You must use daysBetween() in a foreach() statement. You cannot use this function in group by, order by, or filter statements.

Example

How many days did it take to close each opportunity? Use daysBetween().

Example

How long has each opportunity been open for, in days? Use daysBetween() and now().