Service Manager

Home 

AddWorkingDays

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

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

Syntax

AddWorkingDays(hopIdOrName, durationInDays, 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

hopIdOrName

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

durationInDays (Optional) The number of days before or after for which to calculate the working days. If you do not enter a value for this parameter, it defaults to 0, which means that it returns the same date and time that you entered.
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 Service Manager.

Example

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

If today is Tuesday August 11, 2015, this function returns the DateTime value for the date that is 4 working days past Tuesday August 11, 2015. In this case, it returns Monday August 17, 2015 at the same time of day, assuming that there are no exceptions defined during that time in the HOP schedule.

 

$(AddWorkingDays("24 x 7", -4))

If today is Tuesday August 11, 2015, this function returns the DateTime value for the date that is 4 working days before Tuesday August 11, 2015. In this case, it returns Wednesday August 5, 2015 at the same time of day, assuming that there are no exceptions during that time defined in the HOP schedule.

 

$(AddWorkingDays("24 x 7", 10, mydate))

If the value of the mydate parameter is Tuesday August 11, 2015, this function returns the DateTime value for the date that is 10 working days past Tuesday August 11, 2015. In this case, it returns Tuesday August 25, 2015 at the same time of day, assuming that there are no exceptions during that time defined in the HOP schedule.


Was this article useful?