9/23

Generate Weekdays Between Two Dates

Easy

Given two input dates, startDate and endDate, generate a list of all dates between the two dates, excluding Saturday and Sunday.

The start and end dates should be included if they are weekdays.


Example

Input:

startDate = 08/03/2026
endDate = 08/09/2026

Output:

{
08/03/2026,
08/04/2026,
08/05/2026,
08/06/2026,
08/07/2026
}

Saturday 08/08 and Sunday 08/09 are excluded.

ri! Rule Inputs

ri!startDateDate
date(2026, 1, 1)
ri!endDateDate
date(2026, 1, 2)

Example 1 — Case 1

Input: ri!startDate
date(2026, 08, 01)
Input: ri!endDate
date(2026, 08, 10)
Output:
{
  8/3/2026,
  8/4/2026,
  8/5/2026,
  8/6/2026,
  8/7/2026,
  8/10/2026
}

Example 2 — Case 2

Input: ri!startDate
date(2026, 1, 1)
Input: ri!endDate
date(2026, 1, 10)
Output:
{
  1/1/2026,
  1/2/2026,
  1/5/2026,
  1/6/2026,
  1/7/2026,
  1/8/2026,
  1/9/2026
}

Example 3 — Case 3

Input: ri!startDate
date(2026, 12, 30)
Input: ri!endDate
date(2027, 1, 4)
Output:
{
  12/30/2026,
  12/31/2026,
  1/1/2027,
  1/4/2027
}

Appian Expression Tips

  • • Use ri!variableName for rule inputs
  • • Use a!localVariables(local!x: …, body) for locals
  • • Use a!forEach(items: …, expression: fv!item) to iterate
  • • Use where() / reject(fn!isnull, list) to filter