BUSINESS_HOURS_DIFF

Description

Calculates the difference in milliseconds between two Datetime values within business hours. Uses the default schedule if none is provided.

Syntax

BUSINESS_HOURS_DIFF(start_date, end_date, business_hours_name_optional) -> Long

Parameters

ParameterData TypeRequiredDescription
start_dateDatetimeYesThe starting Datetime.
end_dateDatetimeYesThe ending Datetime.
business_hours_name_optionalStringNoThe name of the business hours.

Examples

BUSINESS_HOURS_DIFF(CreatedDate, ClosedDate)
-- Returns the number of milliseconds between CreatedDate and ClosedDate during default business hours.
BUSINESS_HOURS_DIFF(Case_Created__c, First_Response__c, "SupportSchedule")
-- Returns the number of milliseconds between Case_Created__c and First_Response__c during "SupportSchedule" hours.