You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 59 Next »

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.

SimpleSchedule(id, timeZoneTitle)

Instantiates a new SimpleSchedule object.


Parameter(s):

NameTypeMandatoryDefault Value
idStringYN
timeZoneTitleStringN'UTC'


Example:

schedule
const schedule = new SimpleSchedule('157165292607666710', 'UTC');


duration(startDateTime, endDateTime)


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.

Passed dateTime values should be in the schedule. For checking use isInSchedule(datetime) method.


Parameter(s):

NameTypeMandatoryDefault Value
startDateTimeSimpleDateTimeYN
endDateTimeSimpleDateTimeYN


Return:

TypeDescription
SimpleDurationThe difference between the two time values.

Example:

duration
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00');
const endDatetime = new SimpleDateTime('2019-10-29 08:00:00');
const schedule = new SimpleSchedule('157165292607666710');
const duration = schedule.duration(startDatetime, endDatetime);
ss.info(duration.getValue());

load(sysId, timeZoneTitle)


This method initializes a schedule by the sys_id.


Parameter(s):

NameTypeMandatoryDefault Value
sysIdStringYN
timeZoneTitleString (empty string by default)N''

Return:

TypeDescription
VoidThis method does not return a value.

Example:

load
const schedule = new SimpleSchedule();
schedule.load('157165292607666710');

getname()


This method returns the schedule name.


Return:

TypeDescription
StringThe schedule name.

Example:

getName
const schedule = new SimpleSchedule('157165292607666710');
ss.info(schedule.getName()); // Info: 8x5 excluding Russian Holidays


isValid()


This method determines if the specified schedule is valid.


Return:

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


Example:

isValid
const schedule = new SimpleSchedule('157165292607666710');
ss.info(schedule.isValid()); // Info: true

isInSchedule(datetime)


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


Parameter(s):

NameTypeMandatoryDefault Value
datetimeSimpleDateTimeYN


Return:

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


Example:

isInSchedule
const datetime = new SimpleDateTime();
const schedule = new SimpleSchedule('157165292607666710');
ss.info(schedule.isInSchedule(datetime)); // Info: false

setTimeZone(timeZoneTitle)


This method sets a time zone.

Parameter(s):

NameTypeMandatoryDefault Value
timeZoneTitleStringYN


Return:

TypeDescription
VoidThis method does not return a value.


Example:

setTimeZone
const schedule = new SimpleSchedule('157165292607666710');
schedule.setTimeZone('US/Central');

whenNext(datetime, timeZoneTitle)


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


Parameter(s):

NameTypeMandatoryDefault Value
datetimeSimpleDateTimeYN
timeZoneTitle

String

N''

Return:

TypeDescription
SimpleDurationThe SimpleDuration object


Example:

whenNext
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00');
const schedule = new SimpleSchedule('157165292607666710');
ss.info(schedule.whenNext(startDatetime));

whenWillExpire(startDateTime, 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:

whenWillExpire
const startDatetime = new SimpleDateTime('2019-10-25 08:00:00'); // UTC datetime
const finalWorkingSeconds = 600; // 10 minutes
const schedule = new SimpleSchedule('157165292607666710'); // schedule ID
ss.info(schedule.whenWillExpire(startDatetime, finalWorkingSeconds).getValue()); // Info: 2019-10-25 08:10:00

  • No labels