skillfed

business-duration

Calculates business duration in days, hours, minutes and seconds by excluding weekends, public holidays and non-business hours

business-duration v0.68 74.1K downloads/30d#14,874 on PyPI32
Permissive license MIT AGING released

What it is and what it does

Business-Duration is a utility for calculating elapsed time between two dates while respecting business calendars. It excludes weekends, public holidays, and hours outside a defined business window (e.g., 9 AM to 5 PM), returning the result in your choice of unit: days, hours, minutes, or seconds. The package accepts start and end dates as Python datetime objects, optional custom holiday lists, and a weekend definition, making it useful for SLA tracking, ticket resolution times, or any scenario where you need to measure only active business time.

The package depends on numpy and pandas for its core operations. It integrates with the holidays library to handle public holiday calendars and works with both single date pairs and vectorized operations over pandas DataFrames. The implementation is straightforward: you pass datetime objects, business hours, holidays, and a unit, and receive a numeric result representing business duration in that unit.

Use it for:

  • Calculate SLA response or resolution times for support tickets, excluding nights and weekends.
  • Measure project task duration in business days for resource planning and reporting.
  • Batch-process a DataFrame of ticket timestamps to compute business hours elapsed per row.
  • Generate business-day-aware time metrics for compliance or audit reporting.
  • Build custom business calendars with state-specific or company-specific holidays.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Calculates business duration between two dates by excluding weekends, public holidays, and non-business hours, returning results in days, hours, minutes, or seconds.

Yes, if you need business-duration calculations and can tolerate high install friction from numpy/pandas dependencies. The package is stable and permissively licensed, but maintenance is aging—last commit in 2020 with infrequent updates. Suitable for production use in SLA tracking or business-time reporting; consider it a mature utility rather than an actively developed project. No known security vulnerabilities.

Install

business-duration on PyPI

pip

pip install business-duration

uv

uv add business-duration

poetry

poetry add business-duration

Installing business-duration

Before you install

High install friction due to compiled dependencies (numpy, pandas). Package maintenance is aging—last commit was 2020-04-02, though a release appeared on 2025-10-12; the repository remains active but infrequently updated.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions, provided you retain the license notice.

Quickstart

from business_duration import businessDuration
import pandas as pd
from datetime import time

start_date = pd.to_datetime('2017-07-01 02:02:00')
end_date = pd.to_datetime('2017-07-07 04:48:00')
biz_open_time = time(7, 0, 0)
biz_close_time = time(17, 0, 0)

result = businessDuration(startdate=start_date, enddate=end_date,
                          starttime=biz_open_time, endtime=biz_close_time,
                          unit='hour')

Requires numpy and pandas, which have compiled dependencies and may require build tools or pre-built wheels for your platform.

Verify before relying

  • Whether the package works with modern Python versions (requires_python is unspecified in metadata).
  • Whether the 2025-10-12 release represents active maintenance or a one-off update after years of inactivity.

Package facts

License MIT (permissive)
Python support not specified
Install friction high — source build required
Runtime dependencies 2 — numpy, pandas
Maintenance aging — 306 days since the last release
Last repo commit
First released
Downloads 74,128/month — #14,874 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: business_duration-0.68.tar.gz

Keywords: business, duration, time, hour, day, working

Tags

business hours duration calculatorworking days between datesexclude weekends holidays timebusiness time elapsedwork hours durationbusiness day calculatornon-business hours exclusion
business-calendartime-calculationsla-tracking

More Utilities packages