workDaysList
Table of Contents
Overview
The workDaysList function lists workdays between two given dates.
Note:
- This function allows for defining weekends, holiday lists.
- The end date has to be greater than or equal to the start date.
Return Type
Syntax
<variable> = <start_date>.workDaysList(<end_date>,<weekends_list>,<holiday_list>);
where,
Parameter | Data type | Description |
<variable> | COLLECTION | Variable which will contain the collection of work days between two given dates. |
<start_date> | DATE-TIME/TEXT | The date-time value from which the list of workdays should be calculated. |
<end_date> | DATE-TIME/TEXT | The date-time value until which the list of workdays should be calculated. |
<weekends_list> (optional) | COLLECTION | The list of date values (weekends) that should be considered while listing work days. Note: By default, the weekends list is {Saturday, Sunday} |
<holidays_list> (optional) | COLLECTION | The list of holidays that should be considered while listing work days. Note: If no holidays are provided, any day (except weekends) will be considered a working day. |
Examples
The below example lists all the work days between Jan 1, 2020 to Jan 6, 2020.
start_date= "1-Jan-2020"; end_date = "6-Jan-2020"; work_days = start_date.workDaysList(end_date, {"Saturday","Sunday"},{"02-Jan-2020","03-Jan-2020"}); // work_days is assigned the value 'Wed Jan 01 00:00:00 PST 2020,Mon Jan 06 00:00:00 PST 2020,Tue Jan 07 00:00:00 PST 2020'