File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed
Server-Side Components/Script Includes/Calculate Business days dynamically Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change 1+ # Business Day Calculator for ServiceNow
2+
3+ This JavaScript function calculates a future date by adding a specified number of ** business days** (excluding weekends) to a given date.
4+
5+
6+ ## Features
7+ - Skips weekends (Saturday and Sunday)
8+ - Works with any number of business days
9+ - Uses ServiceNow's ` GlideDateTime ` API
10+
11+ ## Usage
12+ 1 . Copy the function into a ** Script Include** , ** Business Rule** , or ** Scheduled Job** in ServiceNow.
13+ 2 . Call the function with:
14+ - A valid date string (e.g., ` '2025-10-24 12:00:00' ` )
15+ - The number of business days to add (e.g., ` 5 ` )
16+
17+ ## Example
18+ ``` javascript
19+ gs .print (add_business_days (' 2025-10-24 12:00:00' , 5 ));
20+ // Output: 2025-10-31 (skips weekend)
You can’t perform that action at this time.
0 commit comments