Days as N = Bus_days_between(D startDate ,D endDate [,C flag [,C holidayTable ]])



The date to which you will add business days.


The number of business days to add. The function does not count weekend days.


Default = "". If Ignore_Holiday_Flag is any non-null value, the function subtracts holidays from the number of non-weekend days.


Optional. Default = "a_holidays.dbf". If Ignore_Holiday_Flag is non-null, the function uses the list of holidays supplied in Holiday_Table. If Holiday_Table is blank, then Alpha Anywhere uses the a_holidays.dbf table which is contained in the Alpha Anywhere program folder. The holidays in the a_holidays.dbf table are defined in the Settings dialog box, accessed with the View > Settings > System > Holidays command from the Alpha Anywhere menus.


BUS_DAYS_BETWEEN() returns the number of business days between two dates, ignoring weekends and holidays. To use a SQL datasource, 'holidayTable' can be a JSON string with these properties: connectionString, table, column. e.g. {connectionString: 'northwind', table: 'holidays', column: 'dates'}


? bus_days_between({1/18/1948}, date() , "yes")
= 14348

The following scripts count the number of business days in the month that contains a specific date.

dim num_days as N 
 dim dd as D 
 dd = date() 
 num_days = bus_days_between(month_start({2/26/06}), month_end({2/26/06})) 
 num_days = bus_days_between(month_start(dd), month_end(dd))

SQL 'Holidays' Table

The Bus_days_between() can use a SQL table as the data source for the list of holiday dates. To specify a SQL table, the 'holidayTable' argument that is passed into the function is in the form of a JSON string with these properties:

  • connectionString

    The connection string to the SQL database

  • table

    The name of the table that contains the holiday dates. If this property is not specified a table called 'A5Holidays' is assumed.

  • column

    The name of the column that contains the holiday dates. If this property is not specified, a column called 'Dates' is assumed.

  • filterColumn

    (optional) the name of a column in the holiday table that you want to filter on

  • filterColumnType

    (required if filterColumn is specified) - the data type of the filterColumn. Can be c,n,d,t,l.

  • filterValue

    (required if filterColumn is specified) - the value to search for.


days = Bus_days_between(  {12/1/2013},{12/31/2013},"yes","{connectionstring: 
'myconnstring', table: 'holidays', column: 'dates'}") 
days = Bus_days_between(  {12/1/2013},{12/31/2013},"yes","{connectionstring: 
'myconnstring', table: 'holidays', column: 'dates', filterColumn: 'country', 
filterColumnType: 'c', filterValue: 'USA'}")

See Also