bizdays: Computes business days between two dates.

View source: R/bizdays.R

bizdaysR Documentation

Computes business days between two dates.


Returns the amount of business days between 2 dates taking into account the provided Calendar (or bizdays.options$get("default.calendar")).


bizdays(from, to, cal)



the initial dates


the final dates


the calendar's name


integer objects representing the amount of business days.

Date types accepted

The arguments from and to accept Date objects and any object that returns a valid Date object when passed through as.Date, which include all POSIX* classes and character objects with ISO formatted dates.

Recycle rule

These arguments handle the recycle rule so vectors of dates can be provided and once those vectors differs in length the recycle rule is applied.

Date adjustment

from and to are adjusted when nonworking dates are provided. Since bizdays function returns the amount of business days between 2 dates, it must start and end in business days. The default behavior, that is defined in Calendar's instantiation with adjust.from and, reproduces the Excel's NETWORKDAYS. A common and useful setting is which moves expiring maturities to the next business day, once it is not.


bizdays("2013-01-02", "2013-01-31", "Brazil/ANBIMA")

# Once you have a default calendar set, cal does not need to be provided
bizdays.options$set(default.calendar = "Brazil/ANBIMA")
bizdays("2013-01-02", "2013-01-31")

dates <- bizseq("2013-01-01", "2013-01-10")
bizdays(dates, "2014-01-31")

bizdays documentation built on May 11, 2022, 1:08 a.m.