Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
This server class provides methods for performing operations on SimpleSchedule objects, such as getting schedule name; determining if the current time value is working time or not or setting time zone for the schedule.
duration(startDate, endDate)
This method determines elapsed time in seconds in the schedule between two date-time values, using schedule time zone or, if not specified, the session time zone.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
startDate | SimpleDateTime | Y | N |
endDate | SimpleDateTime | Y | N |
Return:
Type | Description |
---|---|
SimpleDuration | The difference between the two time values. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let startDate = new SimpleDateTime('2019-10-25 08:00:00'); let endDate = new SimpleDateTime('2019-10-29 08:00:00'); let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); let duration = simple_schedule.duration(startDate, endDate); ss.info(duration.getValue()); |
load(sysId, timeZone)
This method initializes a schedule by the sys_id.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
sysId | Integer | Y | N |
timeZone | String (empty string by default) | N | '' |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let simple_schedule = new SimpleSchedule(); simple_schedule.load('1'); |
getname()
This method returns the schedule name.
Return:
Type | Description |
---|---|
String | The schedule name. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); ss.info(simple_schedule.getName()); |
isValid()
This method determines if the specified schedule is valid.
Return:
Type | Description |
---|---|
Boolean | This method returns TRUE if the schedule is valid; otherwise, it returns FALSE. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); ss.info(simple_schedule.isValid()); |
isInSchedule(time)
This method determines if the given datetime is within the current schedule.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
time | SimpleDateTime | Y | N |
Return:
Type | Description |
---|---|
Boolean | This method returns TRUE if the specified datetime is in schedule; otherwise, it returns FALSE. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let time = new SimpleDateTime(); let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); ss.info(simple_schedule.isInSchedule(time)); |
setTimeZone(timeZone)
This method sets a time zone.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
timeZone | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let time = new SimpleDateTime(); let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); simple_schedule.setTimeZone('US/Central'); |
whenNext(time, timeZone)
This method determines how much time (in seconds) is left until next schedule item starts.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
time | SimpleDateTime | Y | N |
timeZone | String | N | '' |
Return:
Type | Description |
---|---|
SimpleDuration | The SimpleDuration object |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
let startDate = new SimpleDateTime('2019-10-25 08:00:00'); let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow'); ss.info(simple_schedule.whenNext(startDate)); |
whenWillExpire(startDate, finalWorkingSeconds)
This method determines the time after working seconds value specified in the finalWorkingSeconds parameter passes.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
startDate | SimpleDateTime | Y | N |
finalWorkingSeconds | Integer | Y | N |
Return:
Type | Description |
---|---|
SimpleDateTime | The SimpleDateTime object |
Example:
Code Block | ||||
---|---|---|---|---|
| ||||
const startDatestartDatetime = new SimpleDateTime('2019-10-25 08:00:00'); // UTC datetime const finalWorkingSeconds = 600; // 10 minutes let simpleSchedule = new SimpleSchedule('157165292607666710'); // schedules ID ss.info(simpleSchedule.whenWillExpire(startDatestartDatetime, finalWorkingSeconds).getValue()); //2019-10-25 08:10:00 |
Table of Contents | ||||
---|---|---|---|---|
|