daysBetween()

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

daysBetween(date1, date2)

date1 specifies the start date.

date2 specifies the end date.

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.

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

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

See Also