Views:

Description

Returns the next working time given a date to start from and a number of minutes to increment by.

Uses a Monday - Friday work week by default and the records defined in the business close calendar within CRM.

Signature

GetNextWorkingTime(
  'startdate',
  'useBusinessCalendar',
  'DayStartTime', 
  'DayEndTime',
  'NumberOfMins'
)

Example

GetNextWorkingTime(
  '12/20/2012 16:00:00',
  true,
  '9:30',
  '17:00',
  90
)
Returns 12/21/2012 10:00:00 (US Format)

Parameters

Name Type Description Required
startdate xxxx xxxx xxxx
useBusinessCalendar xxxx xxxx xxxx
DayStartTime xxxx xxxx xxxx
DayEndTime xxxx xxxx xxxx
NumberOfMins xxxx xxxx xxxx
Comments (3)
  • What does NumberOfMins do?
    Can you explain how does 12/20/2012 16:00:00 goes to 12/21/2012 10:00:00?
    Why 10AM the next day? 90 minutes seems to be a useless parameter.
    Thanks
  • Hi Jared,

    The 90 in the above example is the number of minutes you want to add to the start date parameter - for this example think of it as a 90 min SLA within working hours. The other parameters define the working day (9:30 to 17:00) and whether or not to include closures from the Business Calendar.  So we start at Dec 20 2012 at 16:00 and then need to add 90 minutes of working time to this starting position. The working day ends at 17:00 so at this point we have only used 60 minutes leaving 30 minutes to add to the next working time, which, in this case is Dec 21 2012 at 09:30. 09:30 plus 30 mins is 10:00. 

    If you just want to retrieve the next working time without adding any additional minutes, set the 'NumberOfMins' parameter to 0.

    Thanks,
    Bruce