Skip to main content

Module for performing simple business day arithmetic; forked from python-bizdatetime

Project description

ABOUT Latest Version Supported Python versions Wheel status License

bizdatim is a simple library for performing business day arithmetic.

Source is hosted at


Rotating weekends/holidays are not supported (e.g., two days working, third day off).

The business hour arithmetic is limited to additions.



Weekly repeating non-business day. Weekend does not have to be at the end (or beginning) or the week. Weekends do not have to be consecutive days.


Like weekend, holiday is a non-business day. Unlike weekend, holiday does not have weekly regularity. It is just a date. Holiday can coincide with weekend.

Working hours

The starting and ending time of a business day.


Is a (possibly empty) collection of weekends, holidays and working hours. All calculations are performed within a policy.


All business day arithmetic is performed in the context of policy:

>>> from bizdatim import Polycy, SAT, SUN
>>> from datetime import date
>>> policy = Policy(weekends=(SAT, SUN), holidays=(date(2011,7,1),))
>>> day = date(2011, 6, 29) # Wednesday
>>> print(policy.add(day, 2))  # add 2 business dates -> Monday after the long weekend, 7, 4)
>>> print(policy.biz_day_delta(date(2011, 7, 4), date(2011, 6, 30)))  # one holiday, one weekend between

There is also the possibility to do arithmetic on business hours:

>>> policy = Policy(weekends=(SAT, SUN), holidays=(date(2011,7,1)), hours=(time(8), time(20)))
>>> day = datetime(2011, 6, 29, 14, 30)
>>> policy.add(day, timedelta(days=1, hours=5))  # The day after, in the afternoon
datetime.datetime(2011, 6, 29, 19, 30)
>>> policy.add(day, timedelta(days=1, hours=10))  # Too many hours, will finish the monday after the long weekend
datetime.datetime(2011, 7, 4, 12, 30)

Policy method docstrings contain more examples.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bizdatim-0.2.0.tar.gz (6.2 kB view hashes)

Uploaded source

Built Distribution

bizdatim-0.2.0-py3-none-any.whl (7.4 kB view hashes)

Uploaded 3 4

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page