Skip to main content

BUSINESS_HOURS

Arnaud Lachaume avatar
Written by Arnaud Lachaume
Updated this week

Type: Function

Function: BUSINESS_HOURS


Syntax: BUSINESS_HOURS(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 hours elapsed between two datetime values.


Full days of work are accounted for based on specified working hours (8 for the default range 09:00 to 17:00), not based on the 24h clock day.


Two business days will be equal to 16 hours when using the default 09:00 to 17:00 working hours. If you change the working hours to be from 06:00 till 22:00 (16-hour day), then this duration becomes 32 hours.


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 timezones is specified below.

Sample usage:

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

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

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

  • BUSINESS_HOURS("2013-06-24T13:35:00", "2013-06-25T18:29:00", "CET", "10:00", "16:00", 2, 4) returns 6.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, thus the 6.0 value.

  • BUSINESS_HOURS("2013-06-24T13:35:00", "2013-07-25T18:29:00", "CET", "10:00", "14:00") returns 92.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. Each weekday is equivalent to 4 hours since the working hours are set from 10:00 till 14:00.


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?