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):

NameTypeMandatoryDefault Value
startDateSimpleDateTimeYN
endDateSimpleDateTimeYN


Return:

TypeDescription
SimpleDurationThe difference between two time values (in seconds).


Example:

Code Block
languagejs
titleduration
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)

Initializes This method initializes a schedule by the sys_id.


Parameter(s):

NameTypeMandatoryDefault Value
sysIdIntegerYN
timeZoneString (empty string by default)N''


Return:

TypeDescription
VoidThis method does not return a value.


Example:

Code Block
languagejs
titleload
let simple_schedule = new SimpleSchedule();
simple_schedule.load('1');


getname()

Returns a This method returns the schedule name.


Return:

TypeDescription
StringThe schedule name.


Example:

Code Block
languagejs
titlegetName
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.getName());


isValid()

Determines This method determines if the specified schedule is valid.


Return:

TypeDescription
BooleanTrue This method returns TRUE if the schedule is valid; otherwise, it returns FALSE.


Example:

Code Block
languagejs
titleisValid
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.isValid());

isInSchedule(time)

Determines This method determines if the given datetime is within the current schedule.


Parameter(s):

NameTypeMandatoryDefault Value
timeSimpleDateTimeYN


Return:

TypeDescription
BooleanTrue This method returns TRUE if the specified datetime is in schedule; otherwise false, it returns FALSE.


Example:

Code Block
languagejs
titleisInSchedule
let time = new SimpleDateTime();
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.isInSchedule(time));

setTimeZone(timeZone)

Setting This method sets a time zone.


Parameter(s):

NameTypeMandatoryDefault Value
timeZoneStringYN


Return:

TypeDescription
VoidThis method does not return a value.


Example:

Code Block
languagejs
titlesetTimeZone
let time = new SimpleDateTime();
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
simple_schedule.setTimeZone('US/Central');

whenNext(time, timeZone)

Determines This method determines how much time (in seconds) is left until next schedule item starts.


Parameter(s):

NameTypeMandatoryDefault Value
timeSimpleDateTimeYN
timeZone

String

N''


Return:

TypeDescription
SimpleDurationThe SimpleDuration object


Example:

Code Block
languagejs
titlewhenNext
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):

NameTypeMandatoryDefault Value
startDate

SimpleDateTime

YN
finalWorkingSecondsIntegerYN


Return:

TypeDescription
SimpleDateTimeThe SimpleDateTime object


Example:


Code Block
languagejs
titlewhenWillExpire
let startDate = new SimpleDateTime('2019-10-25 08:00:00');
let finalWorkingSeconds = 12345;
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.whenWillExpire(startDate, finalWorkingSeconds));


Table of Contents
absoluteUrltrue
classfixedPosition