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

Compare with Current View Page History

« Previous Version 15 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;
  • 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):

NameType
startDateSimpleDateTime
endDateSimpleDateTime


Return:

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


Example:

duration
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 a schedule by the sys_id.

Parameter(s):

NameType
sysIdInteger
timeZoneString (empty string by default)


Return:

TypeDescription
VoidThis method does not return a value


Example:

load
let simple_schedule = new SimpleSchedule();

simple_schedule.load('1');

getname()

Returns a schedule name.


Return:

TypeDescription
StringThe schedule name.


Example:

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


isValid()

Determines if the specified schedule is valid.


Return:

TypeDescription
BooleanTrue if the schedule is valid.


Example:

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


isInSchedule(time)

Determines if the given datetime is within the current schedule.

Parameter(s):

NameType
timeSimpleDateTime


Return:

TypeDescription
Boolean


Example:

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

setTimeZone(timeZone)

Setting a time zone

Parameter(s):

NameType
timeZoneString


Return:

TypeDescription
VoidThis method does not return a value


Example:

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


МетодОписание метода
isWorkingTime(time)

Описание: Определяет, является время рабочим или нет.

Принимает: SimpleDateTime.
Возвращает: boolean.

Пример:

let time = new SimpleDateTime();
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.isWorkingTime(time));

Не выносить в документацию

whenWillExpire(startDate, finalWorkingSeconds)

Описание: Определяет, когда истекает указанное рабочее время.

Принимает:startDate - SimpleDateTime, finalWorkingSeconds - integer
Возвращает: false|string.

Пример:

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

whenNext(time, timeZone)

Описание: Определяет, сколько времени (в секундах) до времени начала следующего элемента расписания.

Принимает: time - SimpleDateTime; (опционально) timeZone - string (по умолчанию - пустая строка).

Возвращает: integer.

Пример:

let startDate = new SimpleDateTime('2019-10-25 08:00:00');
let simple_schedule = new SimpleSchedule('1', 'Europe/Moscow');
ss.info(simple_schedule.whenNext(startDate));



Parameter(s):

NameType



Return:

TypeDescription



Example:


  • No labels