Interval

Returns an interval covering the period between the start date and time and the end date and time, inclusive.

Syntax

Interval(startDateTime, endDateTime)

Enabled For

For a description of the business object categories, see Notes on "Enabled For".

Business Object Category Yes/No
Business Rules: Before-Save Rules Yes
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) Yes
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) Yes
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) Yes
Business Rules: Editing Rules Yes
Business Rules: Initialization Rules Yes
Business Rules: Read Only Rules Yes
Business Rules: Required Rules Yes
Business Rules: Validation Rules Yes
Client Expressions Yes
Object Permissions Yes
Services Yes
LDAP Yes
Mobile Yes
Quick Actions (except UI Quick Actions) Yes
UI Quick Actions Yes
Reports Yes
Search/Dashboard without field references Yes
Search/Dashboard with field references Yes

Parameter

Parameter Description
startDateTime The date and time of the beginning of the interval.
endDateTime The date and time of the end of the interval.

Return Value

DateTime interval in UTC time.

Example

$(Interval("1/31/2014 11:36 AM", "2/2/2014 11:36 AM"))

returns the interval between the two dates.

Although the values for the startDateTime and endDateTime parameters are in UTC, as with all DateTime literals in expressions, these are written in the locale and time zone of the current user.


$(mydate during Interval("1/31/2014 11:36 AM", "2/2/2014 11:36 AM"))

returns true if mydate is between the two DateTime values, inclusive.  This function returns false otherwise.


$(mydate during Interval(BeginningOfMonth(-3), EndOfMonth(0)))

returns true if mydate is in the four-month interval between the start of the month that was 3 months ago and the end of the current month.