Choose where you’d like to start

workDaysList

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,

ParameterData typeDescription
<variable>COLLECTIONVariable 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.

Note

  • In services other than Zoho Creator, the value of this parameter can be entered either as a text or as a date-time value.
  • In Zoho Creator, the value of this parameter can be entered only as a date-time value.
<end_date>DATE-TIME/TEXT

The date-time value until which the list of workdays should be calculated.

Note:

  • If end_date is lesser than the start_date, then an empty value will be returned.
  • In services other than Zoho Creator, the value of this parameter can be entered either as a text or as a date-time value.
  • In Zoho Creator, the value of this parameter can be entered only as a date-time value.

<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'

Related Links

Get Started Now

Execute