Reference > Expressions > Built-in Functions > System Functions > HOPCalcDuration

HOPCalcDuration

Calculates the duration, in seconds, between two dates and times based on an hours of operation (HOP) schedule. The HOP calculation is based on the HOP schedule, which is set in the application configuration.

Syntax

HOPCalcDuration(scheduleName, startDateTime, endDateTime)

Enabled for

Search/Dashboard No
Business Rules Yes
Quick Actions Yes
Workflow Objects Yes
Reports No

Parameters

scheduleName

The HOP schedule name as defined. See Setting Up Hours of Operation.

startDateTime

The start date and time in DateTime value.

endDateTime

The end date and time in DateTime value.

Return Value

Number value.

Example

$(HOPCalcDuration("Weekly HOP", Today(), Tomorrow()) / 3600)

 

The example above returns the total number of working hours for today. It ignores any hours outside of the HOP schedule. If the Weekly HOP sets the working hours as 8am to 5pm, this example returns 9.

This function returns the value in seconds.  To return the value in minutes, divide the result by 60.  To return the value in hours, divide the result by 3600.