Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r0811

D toc

Excerpt

Calculates the work date that is before or after a start date, as specified by a number of days. A set of holiday dates can be optionally specified.

  • Input can be a column reference or the output of the DATE or TIME function.
  • The first value is used as the baseline.
  • The second value is the number of days before or after the start date. 
    • If the second value is negative, the function returns the number of days before the start date.

D s lang vs sql

D s
snippetBasic

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:workday(StartDate, 4)

workday(StartDate, 4)

Output: Returns the date that is four working days after StartDate.

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:workday(date1,numDays,[array_holiday])

workday(date1,numDays,[array_holiday])


ArgumentRequired?Data TypeDescription
date1YdatetimeStarting date to compare
numDaysYintegerNumber of days before or after starting date
array_holidayNarrayAn array of string values representing the valid dates of holidays

D s lang notes

date1

Date value can be column references or output of the DATE function or the TIME function.


D s
snippetusage

Required?Data TypeExample Value
YesDatetime (Column reference or date output of DATE or TIME function)LastContactDate

numDays

An Integer that defines the number of working days distance from the start date. The function returns the start date plus or minus the number of working days represented in this Integer.

If the integer is less than zero, the number of working days are counted backward from the start date.

D s
snippetusage

Required?Data TypeExample Value
Yesinteger10

array_holiday

An array containing the list of holidays, which are factored in the calculation of working days.

Values in the array must be in either of the following formats:

Code Block
['2020-12-24','2020-12-25']
['2020/12/24','2020/12/25']


D s
snippetusage

Required?Data TypeExample Value
YesArray['2018-12,24','2018-12-25','2018-12-31','2019-01-01']

D s
snippetExamples

Example - Date diffing functions

Include Page
EXAMPLE - Date Difference Functions
EXAMPLE - Date Difference Functions

D s also
labeldate