GlideSchedule - Scoped
-
- UpdatedJan 30, 2025
- 4 minutes to read
- Yokohama
- API reference
The scoped GlideSchedule API provides methods for performing operations on GlideSchedule objects, such as adding new schedule segments to a schedule, determining if a date/time is within the schedule, or setting the schedule timezone.
GlideSchedule - GlideSchedule()
Instantiates an empty GlideSchedule object.
Name | Type | Description |
---|---|---|
None |
GlideSchedule - GlideSchedule(String sysID, String timeZone)
Instantiates a GlideSchedule object and loads the schedule information. If a time zone is not specified, the current session time zone is used.
Name | Type | Description |
---|---|---|
sysID | String | The system ID for the schedule. |
timeZone | String | Optional. The time zone to use. Default: The current session time zone. Time zones can be provided in the following formats.
|
Example
GlideSchedule - add(GlideDateTime startDate, GlideDuration offSet)
Adds a new schedule segment to the current schedule.
Name | Type | Description |
---|---|---|
startDate | GlideDateTime | The starting date of the new schedule segment. |
offSet | GlideDuration | The time offset of the new schedule segment. |
Type | Description |
---|---|
GlideDateTime | The schedule updated with the new schedule segment. |
Example
GlideSchedule - duration(GlideDateTime startDate, GlideDateTime endDate)
Determines the elapsed time in the schedule between two date time values using the timezone of the schedule or, if that is not specified, the timezone of the session.
Name | Type | Description |
---|---|---|
startDate | GlideDateTime | The starting datetime. |
endDate | GlideDateTime | The ending datetime. |
Type | Description |
---|---|
GlideDuration | The difference between the starting and ending datetime. |
Example
GlideSchedule - getName()
Retrieves the schedule name.
Name | Type | Description |
---|---|---|
None |
Type | Description |
---|---|
String | The name of the current schedule. |
Example
GlideSchedule - isInSchedule(GlideDateTime time)
Determines if the specified date and time is within the current schedule.
Name | Type | Description |
---|---|---|
time | GlideDateTime | Date and time value to check. |
Type | Description |
---|---|
Boolean | Flag that indicates whether the specified date and time is within the
schedule. Valid values:
|
Example
GlideSchedule - isValid()
Determines if the current schedule is valid. A schedule is valid if it has at least one schedule span.
Type | Description |
---|---|
Boolean | True if the schedule is valid. |
Example
GlideSchedule - load(String sysID, String timeZone, String excludeSpanID)
Loads a schedule with the schedule information.
Name | Type | Description |
---|---|---|
sysID | String | The system ID of the schedule. |
timeZone | String | (Optional) The timezone. If a timezone is not specified, or is nil, the current session timezone is used for the schedule. |
excludeSpanID | String | Any span to exclude. |
Type | Description |
---|---|
void |
Example
GlideSchedule - setTimeZone(String timeZone)
Sets the timezone for the current schedule.
Name | Type | Description |
---|---|---|
timeZone | String | The time zone to use. Time zones can be provided in the following formats.
|
Type | Description |
---|---|
void |
Example
This example sets the timezone for the schedule to US/Pacific.
GlideSchedule - whenNext(GlideDateTime time, String timeZone)
Determines how much time (in milliseconds) until start time of the next schedule item.
This function is intended to be called when the GlideSchedule object (cmn_schedule table) is not currently in the schedule window. The whenNext() call returns duration (in ms) until the GlideSchedule object is within the schedule. This function does not return a meaningful value if called when the GlideSchedule object is within the schedule.
Name | Type | Description |
---|---|---|
time | GlideDateTime | Time to be evaluated |
timeZone | String | Timezone |
Type | Description |
---|---|
Number | Number of milliseconds until the start time of the next schedule item. Returns -1 if never. |
Example
Output:
Example
Output:
On this page
- GlideSchedule - GlideSchedule()
- GlideSchedule - GlideSchedule(String sysID, String timeZone)
- GlideSchedule - add(GlideDateTime startDate, GlideDuration offSet)
- GlideSchedule - duration(GlideDateTime startDate, GlideDateTime endDate)
- GlideSchedule - getName()
- GlideSchedule - isInSchedule(GlideDateTime time)
- GlideSchedule - isValid()
- GlideSchedule - load(String sysID, String timeZone, String excludeSpanID)
- GlideSchedule - setTimeZone(String timeZone)
- GlideSchedule - whenNext(GlideDateTime time, String timeZone)