Skip to main content

BusinessHour functions

get#

The get function takes the businessHour Id as input and returns businessHour object for that id.

Syntax:

new NameSpace("businessHours").get(Number businessHourId);

Returns: Object

Example:

response= new NameSpace("businessHours").get(28);log response;

addHours#

The addHours function takes the businessHour object and hours to be added from current time to that as input and returns the added time in millis format.

Syntax:

new NameSpace("businessHours").addHours(Object businessHour,Number hoursToBeAdded);

Returns: Number

Example:

response= new NameSpace("businessHours").get(28);response1= new NameSpace("businessHours").addHours(response,2);log response1; //1644915061000

addMins#

The addMins function takes the businessHour object and minutes to be added from current time as input and returns the added time in millis format.

Syntax:

new NameSpace("businessHours").addMins(Object businessHour,Number hoursToBeAdded);

Returns: Number

Example:

response= new NameSpace("businessHours").get(28);response1= new NameSpace("businessHours").addMins(response,30);log response1; //1645016188000

getHoursBetween#

The getHoursBetween function takes the businessHour object, from time and end time in millis as input and returns how many hours business has been active.

Syntax:

new NameSpace("field").getHoursBetween(Object businessHour,Number fromTime,Number endTime);

Returns: Number

Example:

response = new NameSpace("field").getHoursBetween(businessHour,fromTime,endTime);log response;

getMinsBetween#

The getMinsBetween function takes the businessHour object, from time and end time in millis as input and returns how many minutes business has been active.

Syntax:

new NameSpace("field").getMinsBetween(Object businessHour,Number fromTime,Number endTime);

Returns: Number

Example:

response = new NameSpace("field").getMinsBetween(businessHour,fromTime,endTime);log response;