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

Compare with Current View Page History

« Previous Version 54 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.

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 the two time values.

Example:

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

load(sysId, timeZone)


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:

load
let simpleSchedule = new SimpleSchedule();
simpleSchedule.load('157165292607666710');

getname()


This method returns the schedule name.


Return:

TypeDescription
StringThe schedule name.

Example:

getName
let simpleSchedule = new SimpleSchedule('157165292607666710');
ss.info(simpleSchedule.getName());


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
let simpleSchedule = new SimpleSchedule('157165292607666710');
ss.info(simpleSchedule.isValid());

isInSchedule(time)


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


Parameter(s):

NameTypeMandatoryDefault Value
timeSimpleDateTimeYN


Return:

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


Example:

isInSchedule
let datetime = new SimpleDateTime();
let simpleSchedule = new SimpleSchedule('157165292607666710');
ss.info(simpleSchedule.isInSchedule(datetime));

setTimeZone(timeZone)


This method sets a time zone.

Parameter(s):

NameTypeMandatoryDefault Value
timeZoneStringYN


Return:

TypeDescription
VoidThis method does not return a value.


Example:

setTimeZone
let simpleSchedule = new SimpleSchedule('157165292607666710');
simpleSchedule.setTimeZone('US/Central');

whenNext(time, timeZone)


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:

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

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:

whenWillExpire
const startDatetime = 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(startDatetime, finalWorkingSeconds).getValue()); 
//2019-10-25 08:10:00

  • No labels