Skip to content

Commit c1f5208

Browse files
authored
Create readme.md
1 parent a2cc679 commit c1f5208

File tree

1 file changed

+20
-0
lines changed
  • Server-Side Components/Script Includes/Calculate Business days dynamically

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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)

0 commit comments

Comments
 (0)