Contact TLCC

New NotesDomino 6 feature - @businessdays Click here to see all the Developer/Admin Tips

Date tip published:12/16/2002
Description:In Release 5 and earlier versions, Notes/Domino programmers went to great lengths to develop formulas to calculate the number of business days between two dates. In Release 6 there is a new function, @BusinessDays. Simply give it the two dates, tell the formula which days of the week are not a business day, and optionally, provide which dates are holidays. @Businessdays will do all the work of computing the number of business days between two dates!


To learn more about the many new enhancements to Release 6 and how to get re-certified as a Release 6 CLP use the following link:

Notes Domino 6 Application Development Update


@BusinessDays

The @BusinessDays function calculates the number of weekdays between a start date and an end date. It also provides these powerful and flexible features:

  • @BusinessDays can calculate the number of weekdays between two date-time lists. The function will compare the dates on a pair-wise fashion, padding the shorter list if necessary.
  • An optional third argument can be included to specify which days of the week are non-business days. The default is to count all days of the week as business days, including Saturday and Sunday. To exclude Saturday and Sunday from the business days calculation, pass 1 : 7 as the third argument (1 for Sunday and 7 for Saturday).
  • An optional fourth argument sets aside specific dates as non-business days. This can be used to indicate holidays and other non-business days.

Syntax - @BusinessDays

The syntax of the @BusinessDays function is:

@BusinessDays( startDates; endDates; daysToExclude ; datesToExclude )

The startDates parameter is a date or list of dates at which to begin counting the business days.

The endDates parameter is a date or list of dates at which to stop counting the business days.

The daysToExclude parameter is optional but is almost always needed. It lists the days of the week which are not considered business days. This is a number or list of numbers: 1 for Sunday, 2 for Monday, and so on. To exclude Saturday and Sunday from the business days calculation, pass 1 : 7 as the third argument.

The datesToExclude parameter is optional and sets aside specific dates for exclusion.

The return value is a number or a number list of the number of days from startDates to endDates, reduced by the daysToExclude and the datesToExclude. When the end date precedes the start date, or a date-time value contains only a time, @BusinessDays returns -1.