You are viewing the documentation for Blueriq 16. Documentation for other versions is available in our documentation directory.

WORKINGDAYS BETWEEN

WORKINGDAYS_BETWEEN


Calculates the working days between two date or dateTime objects. It returns the number of full working days between two dates or dateTimes. The default working days are Monday, Tuesday, Wednesday, Thursday and Friday. This default can be overridden by supplying a list with alternative working days.


Syntax

WORKINGDAYS BETWEEN startDate AND endDate
WORKINGDAYS_BETWEEN ( startDate, endDate, workingDays )



Inputs
  • date1 - The date or dateTime value that represents the start date.

  • date2 - The date or dateTime value that represents the end date.

  • workingDays - A list containing alternative working days. Note that the days should be specified as returned by the DAYOFWEEK function, e.g. Sunday = 1, Monday = 2 etc.

The order in which the dates are placed is irrelevant. WORKINGDAYS_BETWEEN date1 AND date2 = WORKINDAYS_BETWEEN date2 AND date1. Also note that the time component of a datetime value is ignored, similar to the DAYS BETWEEN function.

Return type

  • integer


Examples

ExpressionResultTypeNote
WORKINGDAYS BETWEEN DATE( 2015 , 1 , 1 ) AND DATE( 2015 , 2 , 1 )22Integer
WORKINGDAYS_BETWEEN ( DATE ( 2015 , 1 , 1 ) , DATE ( 2015 , 2 , 1 ) , [ 3, 4, 5, 6, 7 ] )23IntegerWork week Tuesday - Saturday
WORKINGDAYS_BETWEEN ( DATE ( 2015 , 1 , 1 ) , DATE ( 2015 , 2 , 1 ) , [ 2, 3, 4, 5 ] )17Integer4 day work week Monday - Thursday

WORKINGDAYS BETWEEN DATE ( 2015 , 6 , 1 )

AND DATETIME ( 2015 , 6 , 2 , 12 , 0 , 0 )

1IntegerTime is ignored

WORKINGDAYS BETWEEN DATETIME ( 2015 , 5 , 29, 12 , 0 , 0 )

AND DATE ( 2015 , 5 , 31 )

1Integer

Time is ignored

30-5 and 31-5 are Saturday and Sunday