AddWorkingSeconds

Returns the UTC date and time of the second that is the number of working seconds specified earlier than or later than the specified date and time. The application uses the HOP schedule to define the working seconds. See Setting Up Hours of Operation.

If the value of the durationInSeconds parameter is negative, the function returns a DateTime value that is the number of working seconds specified before the value of the hopStartDateTime parameter.

Syntax

AddWorkingSeconds(hopIdOrName, durationInSeconds, hopStartDateTime)

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 Yes1
Business Rules: Initialization Rules Yes
Business Rules: Read Only Rules No
Business Rules: Required Rules Yes1
Business Rules: Validation Rules Yes
Client Expressions No
Object Permissions No
Services Yes
LDAP Yes
Mobile Yes
Quick Actions (except UI Quick Actions) Yes
UI Quick Actions No
Reports Yes
Search/Dashboard without field references Yes
Search/Dashboard with field references No
1. Except when this field appears on a form or is triggered by such a field.  

Parameters

Parameter Description
hopIdOrName

The hours of operation schedule name (for example, 24x7 or 9 to 5) that determines the working and non-working schedule.

durationInSeconds

(Optional) The interval in seconds. If this parameter is not used, it defaults to 0, which means that it returns the very first second of the next work period (operating interval).

You can use basic math operations to calculate the seconds or you can use an expression.

hopStartDateTime

(Optional) The base date and time for the function. If not specified, uses the default date which is the current date and time.

Returns Value

DateTime value in UTC time.

If the application has to display the return value, it implicitly converts it to text, thereby allowing the display format to change depending on your culture code. See Available Languages and Cultures for a list of the culture codes used by Neurons for ITSM.

Example

$(AddWorkingSeconds("24 x 7", 4))

If today is April 10, 2014 at 07:30:32 AM, this function returns the DateTime value for the time that is 4 working seconds past April 10, 2014 at 07:30:32 AM. In this case, it returns April 10, 2014 at 07:30:36 AM, assuming that there are no exceptions defined during that time in the HOP schedule.