---
title: "Create a schedule"
site: admin
version: 1.11
versions: "all"
url: https://docs-new.servicely.ai/admin/1.11/automation/schedules/
type: task
application: platform
last_updated: 2026-10-18
commit: f37120b6b82b
---


Create a schedule when SLAs or reminders must count only working hours, or must skip holidays. A schedule is a short script that builds working time or holidays, and it can include other schedules.

## Before you begin

- You need the `administrator` role.
- Know the working days, hours and holidays to cover, and the schedules you want to include by name.
- You need basic JavaScript. The script uses `ScheduleManager`, `RangeGenerator` and `DateTime`.

## Steps

<Steps>
  <Step>
    In the Admin Console, select **Administration → Configuration → Schedules** to see the existing schedules.

    <Image src="asset:screenshots/admin/automation-schedules/image.png" size="18">The Schedules item in the Configuration menu.</Image>
  </Step>
  <Step>
    Create a new schedule. Enter a **Name** that says what it covers, for example "Monday to Friday 9AM to 5PM, no public holidays". Leave **Number** empty: it is set for you.
  </Step>
  <Step>
    Enter a **Description** and turn on **Active**.
  </Step>
  <Step>
    In **Script**, build the schedule. This script gives Monday to Friday, 9:00 to 17:00:

    ```javascript
    ScheduleManager
        .create()
        .withGenerator(
            RangeGenerator(
                RangeGenerator.WORKDAY,
                {
                    startHour: 9,
                    endHour: 17
                }
            )
        );
    ```
  </Step>
  <Step>
    Select **Create**.
  </Step>
</Steps>

## Result

The schedule appears in the **Schedule** field of SLA definitions and reminder generators. An SLA that uses it counts time only inside the schedule, so its clock stops outside working hours and on included holidays.

## Variations

A `WORKDAY` generator covers Monday to Friday unless you list `workDays`. Use `startTime` and `endTime` as hour, minute and second for times that are not on the hour. Holiday lists hold fixed dates, so update them each year.

### Holidays

Create holidays as a schedule of their own, for example "Core holidays 2027":

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.HOLIDAY,
            {
                holidays: [
                    DateTime([2027, DateTime.JANUARY, 1]),     // New Year's Day
                    DateTime([2027, DateTime.DECEMBER, 25]),   // Christmas Day
                    DateTime([2027, DateTime.DECEMBER, 26])    // Boxing Day
                ]
            }
        )
    );
```

### Regional holidays on top of national ones

Add the regional dates and include the national schedule by name:

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.HOLIDAY,
            {
                holidays: [
                    DateTime([2027, DateTime.NOVEMBER, 2])     // Regional holiday
                ]
            }
        )
    )
    .include('Core holidays 2027');
```

### Working hours with holidays

Include a holiday schedule in a working-hours schedule. SLAs using it do not count time on those holidays:

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.WORKDAY,
            {
                startHour: 9,
                endHour: 17
            }
        )
    )
    .include('Core holidays 2027');
```

### Hours not on the hour

Monday to Friday, 9:45 to 16:20:

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.WORKDAY,
            {
                startTime: [9, 45, 0],
                endTime: [16, 20, 0]
            }
        )
    );
```

### Around the clock

Every day, all day, for work such as P1 incidents that runs regardless of time:

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.WORKDAY,
            {
                startHour: 0,
                endHour: 24,
                workDays: [ DateTime.MONDAY, DateTime.TUESDAY, DateTime.WEDNESDAY, DateTime.THURSDAY, DateTime.FRIDAY, DateTime.SATURDAY, DateTime.SUNDAY ]
            }
        )
    );
```

### Different hours on different days

Monday to Friday 9:00 to 17:00, and Saturday and Sunday 11:00 to 16:00:

```javascript
ScheduleManager
    .create()
    .withGenerator(
        RangeGenerator(
            RangeGenerator.WORKDAY,
            {
                startHour: 9,
                endHour: 17
            }
        )
    )
    .withGenerator(
        RangeGenerator(
            RangeGenerator.WORKDAY,
            {
                startHour: 11,
                endHour: 16,
                workDays: [ DateTime.SATURDAY, DateTime.SUNDAY ]
            }
        )
    );
```

## Related

- [SLAs and when to use them](page:automation/sla-concepts)
- [How SLA evaluation works](page:automation/sla-evaluation)
- [Reminder generators](page:automation/reminder-generators)
- [DateTime](page:api/scripting/datetime)
