Skip to main content

BUSINESS_DAYS

Arnaud Lachaume avatar
Written by Arnaud Lachaume
Updated this week

Type: Function

Function: BUSINESS_DAYS


​Syntax: BUSINESS_DAYS(datetime_start, datetime_end, [timezone="UTC"], [hour_start="09:00"], [hour_end="17:00"], [weekday_start=1], [weekday_end=5])


​Description: Return a decimal number representing the business days elapsed between two datetime values.


Partial business days are calculated relative to the working hours (from 09:00 to 17:00 by default), not based on the 24-hour clock day.

For instance, the business day duration between 10:00 and 14:00 will be 0.5, since it is a duration of 4 hours out of an 8-hour day (from 09:00 to 17:00). If you change the working hours to be from 06:00 till 22:00 (16-hour day), then this business day duration becomes 0.25.


The range of days worked within the week is specified using the ISO8601 standard, where Monday is 1 And Sunday is 7.

The list of supported time zones is specified below.


​Sample usage:

  • BUSINESS_DAYS("2013-06-24T13:30:00", "2013-06-25T18:29:00") returns 1.4375

  • BUSINESS_DAYS("2013-06-24T13:30:00", "2013-06-25T18:29:00", "CET") returns 1.3125. With CET, the clock is moved one hour forward compared to UTC, so fewer work hours are accounted for on the first day.

  • BUSINESS_DAYS("2013-06-24T11:00:00", "2013-06-24T15:00:00") returns 0.5 (same day, half-shift)

  • BUSINESS_DAYS("2013-06-24T13:35:00", "2013-06-25T18:29:00", "CET", "10:00", "16:00", 2, 4) returns 1.0. The first day is ignored since it's a Monday and we've explicitly specified that the week goes from Tuesday (2) to Thursday (4). The second day goes from 10:00 till 18:29, which is equivalent to 10:00 till 16:00 since the hours beyond the shift are ignored. This is equivalent to a full day of work, thus the `1.0` value.

  • BUSINESS_DAYS("2013-06-24T13:35:00", "2013-07-25T18:29:00", "CET", "10:00", "14:00") returns 23.0. The first day is ignored because in CET, the "from" datetime starts after the shift's end (14:00). The last day is accounted in full since it ends after the shift's end. Then all weekdays between the two datetimes get accounted for.

List of supported time zones:

Below is the list of timezone abbreviations supported by timezone argument:

ACST, ADT, AEST, AKDT, AST, AWST, BST, CAT, CDT, CEST, CET, CST, ChST, EAT, EDT, EEST, EET, EST, GMT, HDT, HKT, HST, IDT, IST, JST, KST, MDT, MSK, MST, NDT, NZST, PDT, PKT, PST, SAST, SST, UTC, WAT, WEST, WIB, WIT, WITA
​

For a complete list of all supported "named" timezones (e.g. Europe/Amsterdam), see the following help article.

Did this answer your question?